file—>setting–>plugin 搜索spring assistant安装
确定是否允许annotation processing,打卡 Settings > Build, Execution & Deployment > Compiler > Annotation Processors
Make sure you add the following changes to to your project
For Maven
添加以下依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
For Gradle
添加
dependencies {
optional "org.springframework.boot:spring-boot-configuration-processor"
}
如果项目里面的application的配置文件后缀为properties改为yml,两种配置文件只是语法有区别,这里因为习惯yaml的写法所以,倾向于使用yml
打开src\main\resources\application.yml,尝试输入,可以看到提示成功
image.png
网友评论