2. Purpose of @EnableConfigurationProperties Annotation

It enables support for @ConfigurationProperties annotated classes in our application. However, it's worth to point out that the Spring Boot documentation says, every project automatically includes @EnableConfigurationProperties. Therefore, @ConfiguratonProperties support is implicitly turned on in every Spring Boot application.

In order to use a configuration class in our project, we need to register it as a regular Spring bean.

First of all, we can annotate such a class with @Component. Alternatively, we can use a @Bean factory method.

However, in certain situations, we may prefer to keep a @ConfigurationProperties class as a simple POJO. This is when @EnableConfigurationProperties comes in handy. We can specify all configuration beans directly on this annotation.

This is a convenient way to quickly register @ConfigurationProperties annotated beans.