注意如下的热部署方式在IDEA是默认没有打开自动编译的,手动编译须要快捷键(Ctrl+Shift+F9),自动编译的修改配置以下:(注意刷新不要太快,会有1-2秒延迟)html
在pom中直接引入依赖spring
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency>
设置如下两项(第一项如已设置直接设置第二项)app
1) “File” -> “Settings” -> “Build,Execution,Deplyment” -> “Compiler”,选中打勾 “Build project automatically” 。maven
2) 组合键:“Shift+Ctrl+Alt+/” ,选择 “Registry” ,选中打勾 “compiler.automake.allow.when.app.running” 。spring-boot
以后直接正常run便可!ui
在Plugins中添加依赖spa
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <dependencies> <!-- spring热部署 --> <dependency> <groupId>org.springframework</groupId> <artifactId>springloaded</artifactId> <version>1.2.6.RELEASE</version> </dependency> </dependencies> </plugin> </plugins> </build>
// 若是依赖提示not found,先在上面写让maven下载下来,再移到Plugin里面来命令行
命令行窗口启动code
找到pom.xml的路径,IDEA的话打开Pom后在标签页鼠标悬停便可看到,或者在pom上右击->file Pathxml
在这个路径下打开cmd窗口(win下能够经过shift快速在对应路径打开),输入启动命令
mvn spring-boot:run
转载:https://www.cnblogs.com/jiangbei/p/8439394.html