美文网首页
4、thymeleaf热部署

4、thymeleaf热部署

作者: ltjxwxz | 来源:发表于2017-11-12 20:50 被阅读0次

    1、spring boot配置文件设置如下
    关闭thymeleaf缓存

    spring:
      thymeleaf:
        encoding: UTF-8
        mode: HTML5
        cache: false
    

    2、idea中设置如下:
    2.1、自动builder


    image.png

    2.2、注册一个快捷键


    image.png

    2.3、打开刚刚注册的快捷键,搜索compiler.automake...勾上


    image.png

    2.4、以上操作在idea中已经可以实现热部署了,但是在eclipse中还不行,需要以下操作。
    (1)pom文件增加依赖和插件

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
        <scope>true</scope>
    </dependency>
    
    
    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>1.5.8.RELEASE</version>
    </plugin>
    
    <plugin>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-maven-plugin</artifactId>
         <configuration>
             <fork>true</fork>
         </configuration>
     </plugin>
    

    (2)开启Build Automatically。
    注意有坑:项目中用到了quartz,获取TestSuite一直报类型转换错误,com.picc.autoplateform.model.TestSuite cannot be cast to com.picc.autoplateform.model.TestSuite,TestSuite明明就是同一个东西,还转换错误了。把add boot devtools步骤中在pom文件增加的依赖包去掉就ok了。

    JobDataMap dataMap = context.getJobDetail().getJobDataMap();
    TestSuite testSuite = (TestSuite)dataMap.get("testSuite");
    

    相关文章

      网友评论

          本文标题:4、thymeleaf热部署

          本文链接:https://www.haomeiwen.com/subject/mbmomxtx.html