eip-admin-starter-views 工程导入了devtools热部署工具,用户在修改完静态资源后不需要再手动重启工程。具体使用方法如下:

    1. 确认依赖和插件导入,eip-admin-starter-views 工程已导入依赖和插件,使用前首先进行确认
    1. <!--引入热部署组件-->
    2. <dependency>
    3. <groupId>org.springframework.boot</groupId>
    4. <artifactId>spring-boot-devtools</artifactId>
    5. <scope>true</scope>
    6. <optional>true</optional>
    7. </dependency>
    1. <plugin>
    2. <groupId>org.springframework.boot</groupId>
    3. <artifactId>spring-boot-maven-plugin</artifactId>
    4. <configuration>
    5. <fork>true</fork>
    6. </configuration>
    7. </plugin>
    1. 确认配置文件正确,相关配置信息在 application.yml
    1. #热部署工具
    2. devtools:
    3. restart:
    4. enabled: true #设置开启热部署
    5. additional-paths: src/main/java #重启目录
    6. exclude: WEB-INF/**
    7. freemarker:
    8. cache: false #页面不加载缓存,修改即时生效

    同时确保thymeleaf缓存为false

    1. thymeleaf:
    2. # 开发改为false、生产改为true
    3. cache: false
    1. idea开启自动编译
      设置【idea】→【File】→【Settings】→【build project automatically】→ 选中idea自动编译.png
    2. idea设置Registry
      设置【idea】→【File】→【Settings】→【Registry】,找到并勾选compiler.automake.allow.when.app.running

    register.png
    这样就可以使用前端热加载了,用户更改静态资源后不需要手动重启工工程,idea即会自动重新编译静态资源。