What difference does @EnableConfigurationproperties make if a bean is already annotated with @ConfigurationProperties?

前端 未结 3 782
一个人的身影
一个人的身影 2021-01-31 08:20

The Spring Boot documentation says that to use the @ConfigurationProperties annotation

You also need to list the properties classes to regis

3条回答
  •  闹比i
    闹比i (楼主)
    2021-01-31 08:29

    It took me a while to reach to this post but would like to add here so that others may get benefited.

    @ConfigurationProperties - Used to bind a class with an externalized property file. Very powerful and must be used to separate out bean classes with configuration entity class.

    @Configuration - Creates a Spring bean of configuration stereotype.

    @EnableConfigurationProperties - Creates a binding between a configuration entity class and Spring configuration stereotype so that after injection within a service properties can be retrieved easily.

提交回复
热议问题