Configuration properties - type-safe Configuration Management

While the ;@Value annotation provides dynamic configuration, it also has several drawbacks:

  • If we want to use three property values in a service, we would need to autowire ;them using @Value three times.
  • The @Value annotations and the keys of the messages would be spread across the application. If we want to find the list of the configurable values in an application, we have to search through the application for @Value annotations.

Spring Boot provides a better approach to application configuration through the strongly typed ConfigurationProperties feature. This allows us to do the following:

  • Have all the properties in a predefined bean structure
  • This bean would act as the centralized ...

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.