@ConfigurationProperties失效的几种情况看看你是那种

1:yml文件换成properties文件

2:pom.xml添加

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>

3:添加插件

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

 

4:启动类添加@EnableConfigurationProperties({MailProperties.class})

 

 

posted @ 2022-05-06 17:23  My_blog_s  阅读(1153)  评论(0编辑  收藏  举报