In Spring, you can use @Value("#{expression}") to inject values at runtime, where the expression is a Spring Expression Language (SpEL) expression. Here's a syntax reference for various use cases:
Supported types include strings, dates, numeric values (int, real, and hex), boolean, and null.
#{'Hello World'}#{3.1415926}#{true}#{null}#{1,2,3,4}#{{'a','b'},{'x','y'}}#{name:'Nikola',dob:'10-July-1856'}#{name:{first:'Nikola',last:'Tesla'},dob:{day:10,month:'July',year:1856}}#{'abc'.length()} (evaluates to 3)#{f('hello')} (assumes f is a method in the class to which this expression belongs, taking a string parameter)These examples demonstrate the flexibility of SpEL, allowing for the dynamic evaluation of expressions for value injection.