SpringBoot在IntelliJ IDEA下for MAC 热加载

说在前面

热加载:文件内容变更服务器自动运行最新代码。实则在IDEA环境进行热部署后,下述过程一气呵成。

1代码变更,文件自动保存(IDEA自动保存代码,用户无需使用COMMAND+SAVE快捷键);

2Javadoc重新编译Java文件生成Class文件;

3Class文件组合生成jar、war包;

4服务器自动运行最新服务包。

-------------------------------------------------------------------------------------------------------------------------

正文 配置  

1引入热加载插件

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
</dependency>

2配置Compiler,增加auto build

  Preference->Build,Execution,Deployment->Compiler->勾选Build project automatically

3Preferences->查找并选择“Registry” ->找到“complier.automake.allow.when.app.running”->勾选此项

PS:

1亲测有效,此配置适合IDEA环境的springboot项目,Eclipse配置过程需作改动

2亲测有效,前文“代码变动”包括但不限于.java、.xml、.properties等类型文件

测试环境

IntelliJ IDEA 2018.1.4 (Ultimate Edition)
Build #IU-181.5087.20, built on May 17, 2018
Licensed to Chation

JRE: 1.8.0_152-release-1136-b39 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.12.6

Git Demo Path:https://github.com/MingHaiTian/springboot-start.git

猜你喜欢

转载自www.cnblogs.com/tianmh/p/9186839.html