We want to create a Boolean Property with the Spring @Value Annotation. Piece of cake, right? But the thing is, the property in our application.properties file is a STRING, not a Boolean. So we need to evaluate its value with SpEL and set our Boolean accordingly.
Here are our two properties.
Jumping straight to the solution, here is how we declare them with SpEL. In the first assignment we're creating a Boolean from a Boolean property, but current.status.property is tricky. We are evaluating its String value and creating a Boolean. Be careful to use the syntax shown here without one bracket or single quote out of place.
Notice, too, that our SpEL evaluation takes precedence over the variable's assignment as you see in the output.
For giggles we'll change the properties to the following.
With the following output.