1. 程式人生 > >IDEA下 SpringBoot 熱部署

IDEA下 SpringBoot 熱部署

一、環境

  • IntelliJ IDEA 2017.1.4 x64

二、SpringBoot 配置

<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<optional>true</optional>
		</dependency>
<build>
		<plugins>
			<plugin>
				<groupId
>
org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> </configuration> </plugin> </plugins> </build>

三、IDEA 設定

  1. 自動build

這裡寫圖片描述

  1. Register配置

Ctrl+Shift+Alt+/ => Register => 找到並勾選compiler.automake.allow.when.app.running =>IDEA重啟

這裡寫圖片描述

四、測試

確認IDEA重啟後,debug啟動SpringBoot專案,修改第一篇文章的HelloController

@RequestMapping(value = "sayhello", method = RequestMethod.GET)
	public String sayhello(){
		return "Hello SpringBoot !";
	}

"Hello SpringBoot !"; == > "Hello SpringBoot 2 !";

這裡寫圖片描述

測試成功