Externally configuring application properties

Spring Boot allows you to create your own customized configuration of application properties with beans. You can register these beans as properties with Spring Boot by using the @ConfigurationProperties annotation, and after this, you can set these properties by using either the application.properties or application.yml file.

Spring Boot provides alternative ways of working with properties that allow you to strongly type safe beans and validate the configuration of your application. Let's see the use of the @ConfigurationProperties annotation for a dedicated container bean:

  • This @ConfigurationProperties annotation will hold the externalized properties
  • It avoids repeating the prefix
  • Data members ...

Get Mastering Spring Boot 2.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.