Using the Environment instance directly is a bit cumbersome, so the Spring developers created another annotation called @Value which is capable of accessing data from the environment and assigning it to a field. The field can be of any type that is supported out of the box such as primitive types or other default Java classes, or you can provide a ConversionService or PropertyEditors which are mechanisms that Spring uses to convert data to and from strings. Being able to create your own converters is out of the scope of this book.
Take a look at the example code below: (excerpt from BlogService.java):
@Value("${my.config.feature.flag:false}")
boolean featureFlag;
This loads the value using the key my.config.feature.flag and converts it to a boolean value. The value is false by default when the config key is not set. Therefore, the syntax is @Value("${KEY:DEFAULT}") with the default value and @Value("${KEY}") without. The default value is the string representation of the default value in the same format that you expect in the config file.
Lists are values that are set with square brackets and comma separated values like [1,3,5,7,9]; which is a list of odd integer values.