SpringBoot 自定义starter yaml提示失效问题及解决方法
作者:不爱吃奶昔 时间:2022-08-03 14:58:42
自定义starter yaml提示失效问题
问题场景
在自定义starter
后,必不可少会有properties
配置参数需要指定,而在有时又不知道为什么出现这个问题。官方 Configuration Metadata
在其它模块里导入自定义starter,编写yaml时,没有提示:
自定义starter中也添加了configuration-processor依赖:
最终定位问题,发现由于自定义annotationProcessorPaths
覆盖默认配置,导致配置提示文件spring-configuration-metadata.json
没有生成:
网上找到的解决办法(并不能解决我的问题):
缺少依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
重新build project
遇事不决重启(重新打开idea)
解决办法
既然已经知道是由于自定义annotationProcessPaths
,导致提示文件没有生成,那么就对症下药,添加configuration-processor
注解执行路径,重新clear
、install
:
<path>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>${project.parent.version}</version>
</path>
现在再回到引入starter
依赖的项目中,发现yaml提示已经恢复正常了:
来源:https://blog.csdn.net/qq_19152901/article/details/128355709
标签:SpringBoot,starter,yaml,提示失效
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
C# Dynamic关键字之:调用属性、方法、字段的实现方法
2022-09-22 04:23:39
![](https://img.aspxhome.com/file/2023/9/86979_0s.jpg)
C# Dynamic关键字之:解析dynamic就是Object
2022-09-16 15:08:16
![](https://img.aspxhome.com/file/2023/0/116620_0s.png)
Spring Security实现基于角色的访问控制框架
2022-03-19 05:40:53
![](https://img.aspxhome.com/file/2023/0/110920_0s.png)
C# 对XML基本操作代码总结
2022-08-21 16:09:09
Android图文居中显示控件使用方法详解
2023-04-04 14:07:24
Android仿微信单击拍照长按录像功能实例代码
2022-01-16 17:45:07
学习SpringBoot容器功能及注解原理
2023-11-24 22:06:17
![](https://img.aspxhome.com/file/2023/4/59044_0s.png)
java生成图片验证码实例代码
2022-01-06 04:01:37
Java Hibernate使用SessionFactory创建Session案例详解
2022-03-04 06:21:28
Unity之Luaframework框架lua调用C#方法
2022-02-14 11:22:26
![](https://img.aspxhome.com/file/2023/1/94631_0s.png)
十分钟速懂java知识点 System类
2022-11-25 04:19:26
![](https://img.aspxhome.com/file/2023/4/64894_0s.png)
c#中分割字符串的几种方法
2023-04-11 16:04:30
android: targetSdkVersion升级中Only fullscreen activities can request orientation问题的解决方法
2023-07-26 13:56:08
.NET企业级项目中遇到的国际化问题和解决方法
2022-12-03 08:18:06
Java使用Tess4J实现图像识别方式
2022-10-07 19:24:11
![](https://img.aspxhome.com/file/2023/9/60659_0s.png)
Java实现pdf转图片案例
2022-08-11 21:45:41
Spring的Aware接口你知道多少
2023-01-19 12:44:20
![](https://img.aspxhome.com/file/2023/9/126349_0s.jpg)
Android中应用多进程的整理总结
2022-05-05 04:25:21
Java创建和启动线程的两种方式实例分析
2023-12-05 08:26:59
Java并发编程之线程之间的共享和协作
2021-07-20 14:28:27
![](https://img.aspxhome.com/file/2023/4/86694_0s.png)