1.未配置 Spring Boot 配置注解处理器
解决方法:
添加依赖到pom.xml
使用@ConfigurationProperties注解注入属性值,添加依赖spring-boot-configuration-processor
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency>
2.配置热部署
- 在 pom.xml 文件中,添加项目
spring-boot-devtools
依赖
<!--热部署依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency>
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> </configuration> </plugin>
设置 IDEA 环境自动编译
在使用 IDEA 编译器时,需要设置自动编译。
1.File-Settings-Compiler-Build Project automatically
2.ctrl + shift + alt + / ,选择Registry,勾上 Compiler autoMake allow when app running(若找不到,说明已勾选上在设置里)
快捷键 ctrl+shift+alt+/
热部署找不到compile.automake.allow.when.app.running
目前已经被idea官方更新到setting里面设置
具体设置位置
file->setting->Advanced Setttings里面的
注解爆红
<dependency> <groupId>org.hibernate.javax.persistence</groupId> <artifactId>hibernate-jpa-2.1-api</artifactId> <version>1.0.2.Final</version> </dependency>