首页 > 编程语言 > 详细

@configurationProperties注解时 idea弹出 Spring Boot Annotion processor not found in classpath

时间:2020-03-31 21:20:42      阅读:101      评论:0      收藏:0      [点我收藏+]

 技术分享图片

@ConfigurationProperties(prefix="") 没有指定 classpath 时,IDEA 提示没有找到 classpath。

原因:

1--》在没指定路劲的情况下,默认在 resource 下的 applications.properties (yml) 中查找,

如果找到则返回值,如果没有找到则返回默认值null/0/false…所以不用管它也是

可以正常运行的, 有时候无法注释数据为null

2--》加入依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
之后如果ConfigurationProperties继续报错:Not registered via @EnableConfigurationProterties or marked as……
解决办法:加上@Component注解

 

可以关闭 IDEA 的提示:

setting 下搜索 spring,找到 springBoot 取消勾选 show notification panel

controller的使用

技术分享图片

 

@configurationProperties注解时 idea弹出 Spring Boot Annotion processor not found in classpath

原文:https://www.cnblogs.com/wzb-liumangtu/p/12608458.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!