springboot不同工具(idea,eclipse)修改页面不需要重启就生效

1.eclipse修改页面不用重启的配置

在pom.xml文件里面添加依赖

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>springloaded</artifactId>
            <version>1.2.6.RELEASE</version>
        </dependency>
        
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>

2.idea修改页面后不用重启的操作配置

2.1打开IDEA2017,依次选择File→Settings→Build,Execution,Deployment→Compiler勾选Build project automatically,点击apply,再点击ok。如下图所示:

2.2在 IDEA中用快捷键Ctrl + Shift + A搜索命令,输入registry,选择第一个,勾选compiler.automake.allow.when.app.running。

2.3添加maven依赖

        <dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>springloaded</artifactId>
			<version>1.2.6.RELEASE</version>
		</dependency>

2.4开启热部署(pom.xml中,此项不是必须的,但是配置的话,就要按下面来走)

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <fork>true</fork>//必须配置,必须配置,必须配置
            </configuration>
        </plugin>
    </plugins>
</build>

2.5 如果还是不行,一定要检查IDEA是不是关闭了power save mode,如果没有关闭,一定要关闭。 

power save mode 开启后代码不提示,   省电模式(经典模式:适用低配版电脑)

File >Power Save Mode 被勾选了 去掉勾选就可以了

猜你喜欢

转载自blog.csdn.net/u012060033/article/details/88963406