打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

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

 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Spring Boot 最核心的 25 个注解
【原创】Spring Boot一口气说自动装配与案例
spring-boot 配置从使用到原理
spring中那些让你爱不释手的代码技巧(续集)
idea中使用docker一键部署(spring boot)项目运行
idea下的spring boot remote debug 启动办法
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服