@ConfigurationProperties 并不是一个可以被扫描到的 Bean。@ConfigurationProperties 主要用于将配置文件中的属性绑定到一个 Java 对象上,用来方便地进行属性配置和读取。这里的 Java 对象并不会被容器识别为 Bean。
@ComponentScan 注解主要用于扫描指定的包,将所有带有 @Component、@Service、@Controller、@Repository、@Configuration 等注解的类注册成 Bean。因此,当使用 @ComponentScan 扫描包时,它只会扫描到带有上述注解的组件,并将其注册到 Spring 容器中,而不会扫描到 @ConfigurationProperties 注解。
不过,当使用 @ConfigurationProperties 注解时,需要将其包含在一个带有 @Component、@Service、@Controller、@Repository、@Configuration 等注解的类中,才能使其被扫描到并注册成为一个 Bean。这时,在扫描到这个类时,@ConfigurationProperties 所标注的 Bean 也会被创建并注册到 Spring 容器中。因此,当使用 @ComponentScan 扫描包时,如果扫描到了带有 @ConfigurationProperties 注解的类,它会被自动注册到 Spring 容器中。
综上所述,@ComponentScan 不会直接扫描 @ConfigurationProperties,但是当 @ConfigurationProperties 被包含在一个带有 @Component、@Service、@Controller、@Repository、@Configuration 等注解的类中时,这个类会被扫描到,从而注册 @ConfigurationProperties 所标注的 Bean。