1.首先加入依赖,直接在pom文件中加入:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.6.RELEASE</version>
</dependency>
<!--热部署依赖结束-->
2.添加插件:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.xiaomoguvip.XiaomoguvipApplication</mainClass>
</configuration>
</plugin>
</plugins>
</build>
3.IDEA设置:
1.“File” -> “Settings” -> “Build,Execution,Deplyment” -> “Compiler”,选中打勾 “Build project automatically”【自动编译class】
2.组合键:“Shift+Ctrl+Alt+/” ,选择 “Registry” ,选中打勾 “compiler.automake.allow.when.app.running” [编译后自动运行]
3.使用 mvn springboot:run运行项目。
在网上碰了好多坑,很是烦恼,为了让朋友们少走坑,写了本章,亲测可行!
网友评论