身为JAVA程序员,等待代码编译是一件痛苦的事情。况且追求高效是程序员所具有的一种天然品性。
在接触强大的springboot框架过程中,每次修改代码后,都要重新启动。我就想,肯定有方法可以实现代码修改后热加载/部署,果不其然,springboot早已为我们准备了解决方案,且方便快捷。收集了一些资料后,亲身验证,以下方法可行,请参照以下方法设置。(本文以idea 为例子)
第一步: 在pom.xml增加下面依赖
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-devtools</artifactId>
- </dependency>
第二步: 打开idea ,File->Settings-> Build-Execution-Deployment -> Compiler
勾选 Build Project Automatically.
第三步: 按 Shift+Ctrl+A (windows,mac是 command+shift+A)
将看到弹窗 Enter Action or option name,输入"registry",双击第一项"Registry..." ,会弹出另一个窗口,寻找
compiler.automake.allow.when.app.running
这一项,并勾选开启。然后关闭窗口。