美文网首页
Springboot 技术整合--笔记13-修改html等不重启

Springboot 技术整合--笔记13-修改html等不重启

作者: 牵手生活 | 来源:发表于2019-07-12 11:22 被阅读0次

pom.xml导入包

        <!-- 热部署 -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>springloaded</artifactId>
        </dependency>


        <!-- 热部署 -->
        <!-- devtools可以实现页面热部署(即页面修改后会立即生效,
            这个可以直接在application.properties文件中配置spring.thymeleaf.cache=false来实现) -->
        <!-- 实现类文件热部署(类文件修改后不会立即生效),实现对属性文件的热部署。 -->
        <!-- 即devtools会监听classpath下的文件变动,并且会立即重启应用(发生在保存时机),
            注意:因为其采用的虚拟机机制,该项重启是很快的 -->
        <!-- (1)base classloader (Base类加载器):加载不改变的Class,例如:第三方提供的jar包。 -->
        <!-- (2)restart classloader(Restart类加载器):加载正在开发的Class。 -->
        <!-- 为什么重启很快,因为重启的时候只是加载了在开发的Class,没有重新加载第三方的jar包。 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <!-- optional=true, 依赖不会传递, 该项目依赖devtools;
                之后依赖boot项目的项目如果想要使用devtools, 需要重新引入 -->
            <optional>true</optional>
        </dependency>

设置Build project automatically

File” -> “Settings” -> “Build,Execution,Deplyment” -> “Compiler”,选中打勾 “Build project automatically”

设置automake.allow.when.app.running

组合键:“Shift+Ctrl+Alt+/” ,选择 “Registry” ,选中打勾 “compiler.automake.allow.when.app.running”

在web app运行后,修改html文件,刷新如果没用效果,请用一下build

image.png

相关文章

网友评论

      本文标题:Springboot 技术整合--笔记13-修改html等不重启

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