欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

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

来源: javaer 分享于  点击 28620 次 点评:256

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


 

@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的使用

 

相关文章

    暂无相关文章
相关栏目:

用户点评