SpringBoot项目中获取yml文件的属性时实体属性类出现Spring Boot Configuration Annotation Processor not found in classpath

1.SpringBoot项目的项目结构如下:

2.属性实体类

 上面出现了Spring Boot Configuration Annotation Processor not found in classpath的原因是@ConfigurationPropertySource注解是用来加载properties文件,但@ConfigurationPropertySource注解无法自动加载yml配置文件,因此就出现了这个红色提示信息,但是这种情况并不影响程序的允许,在项目启动之后SpringBoot自动加载yml属性配置文件,最终还是会将yml文件中配置的属性自动获取并注入cupSize和age两个属性上面。

猜你喜欢

转载自blog.csdn.net/y_bccl27/article/details/82292474