IDEA 2020.1 热部署(不安装JRebel)


 IDEA不需要安装JRebel即可实现热部署。

    版本:IDEA 2020.1 

    日期:2020-09-08 11:07:40

    需要三步:pom依赖、Settings设置、特殊设置

1.pom文件中要有devtools依赖和maven-plugin插件:

 
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-devtoolsartifactId>
            <scope>runtimescope>
            <optional>trueoptional>
        dependency>

            <plugin>
                <groupId>org.springframework.bootgroupId>
                <artifactId>spring-boot-maven-pluginartifactId>
                <version>2.3.0.RELEASEversion>
                <configuration>
                    
                    <mainClass>com.example.demo.DemoApplicationmainClass>
                configuration>
                <executions>
                    <execution>
                        <id>repackageid>
                        <goals>
                            <goal>repackagegoal>
                        goals>
                    execution>
                executions>
            plugin>

2.在设置中打开自动编译:

 3.打开运行时编译,按快捷键 Shift+Ctrl+Alt+/ ,选择 Registry,找到找到compiler.automake.allow.when.app.running进行勾选,然后Close

 

   然后就可以了。

  还可以在application.properties配置文件添加如下配置,做一些自定义设置,一般也没多大用,不配置也能用:

#热部署生效
spring.devtools.restart.enabled=true
#设置重启的目录
spring.devtools.restart.additional-paths=src/main/java
#设置不重启目录
spring.devtools.restart.exclude=WEB-INF/** 

  最后,以上种种,mybatis的mapper.xml文件能否热部署并没有尝试,尝试过的可以在下方留言惠及大家。