SpringBoot系列教材 (六)- 基础 - 如何让springboot自动重启

步骤1:必须重启
步骤2:pom.xml
步骤3:重启测试

步骤 1 : 必须重启

目前的Springboot,当发生了任何修改之后,必须关闭后再启动Application类才能够生效,显得略微麻烦。 Springboot提供了热部署的方式,当发现任何类发生了改变,马上通过JVM类加载的方式,加载最新的类到虚拟机中。 这样就不需要重新启动也能看到修改后的效果了

步骤 2 : pom.xml

做法很简单,在pom.xml中新增加一个依赖和一个插件就行了。
依赖:

<dependency>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-devtools</artifactId>

    <optional>true</optional> <!-- 这个需要为 true 热部署才有效 -->

</dependency>


插件:

<plugin>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-maven-plugin</artifactId>

</plugin>

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="http://

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值