热部署配置

导入包:

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

如果导入不了,可导入:

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

运行错误再删除:

<version>RELEASE</version>

运行;

yml配置:

spring:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://192.168.100.128:3306/dns_qz?characterEncoding=utf8
    username: root
    password: root
  freemarker:
    cache: false
  thymeleaf:
    cache: true
  devtools:
    remote:
      restart:
        enabled: true
    restart:
        additional-paths: src/main/java

properties:

#开启或者关闭freemarker和thymeleaf的页面缓存
spring.freemarker.cache=false
spring.thymeleaf.cache=true
spring.devtools.restart.enabled=true
#需要开启热部署的文件目录
spring.devtools.restart.additional-paths=src/main/java
#使用了mybatis好像需要设置,应该没有必要。且生产环境需要移除
#restart.include.mapper=/mapper-[\\w-\\.]+jar
#restart.include.pagehelper=/pagehelper-[\\w-\\.]+jar
#静态文件下不需要重启
#spring.devtools.restart.exclude=static/**,public/**
#spring.devtools.restart.exclude=WEB-INF/**
 

猜你喜欢

转载自blog.csdn.net/weixin_43608538/article/details/88020788