如何在IDEA Intellij上使用Spring-boot进行自动重新加载 [英] how to make auto reload with Spring-boot on IDEA Intellij
问题描述
我已经基于Spring-boot,tomcat,freemarker编写了一个项目,我成功运行了该项目,但是每当我修改一些模板和java类时,都必须重新启动服务器或使用Intellij上的重新加载已更改的类"菜单来使更改生效.浪费很多时间!
I had wrote a project base on Spring-boot,tomcat,freemarker, I run it successful, but whenever I modify some templates and java class, I must restart server or use "reload changed classes" menu on Intellij to make the changes become effective. It wastes lots time!
然后,我尝试使用springloaded作为这位官员说:
Then I try to use springloaded as the official said:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.0.RELEASE</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/springloaded-1.2.0.RELEASE.jar</systemPath>
</dependency>
</dependencies>
</plugin>
然后我重新运行服务器,但是无法正常工作! 在模板或类上进行任何更改后,我仍然需要重新启动服务器.
then I rerun server, but doesn't work as expected! I still need to restart server after any change on template or class.
如何配置弹簧加载以自动重新加载. 非常感谢!
How could I configure the springloaded to auto reload. Thanks a lot!
Spring-boot的版本为1.3.0RC1
The version of Spring-boot is 1.3.0RC1
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.RC1</version>
</parent>
Maven版本:3.2 杰克:1.8 智慧:14.1.5 os:windows 8.1 64位
maven version:3.2 jdk:1.8 intellij :14.1.5 os:windows 8.1 64 bit
推荐答案
首先,请确保已添加spring-boot-devtools
作为依赖项:
First, be sure that you added spring-boot-devtools
as dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
第二,确认已选中选项复选框File->Setting –> Build, Execution, Deployment –> Compiler–>
自动构建项目.
Second, verify that the option check-box File->Setting –> Build, Execution, Deployment –> Compiler–>
Build project automatically is selected.
最后,对于Linux/Windows用户,请按SHIFT+CTRL+A
;对于Mac用户,请按Command+SHIFT+A
,然后在打开的弹出窗口中输入 registry .使用向下箭头键向下滚动到Registry...
,然后在Registry...
上单击ENTER
.在Registry
窗口中,确认已选中 compiler.automake.allow.when.app.running 选项.
Last, press SHIFT+CTRL+A
for Linux/Windows users or Command+SHIFT+A
for Mac users, then type registry in the opened pop-up window. Scroll down to Registry...
using the down arrow key and hit ENTER
on Registry...
. In the Registry
window verify the option compiler.automake.allow.when.app.running is checked.
以上说明摘自 查看全文