IDEA中SpringBoot2.X热部署Dev-tool和常见问题

什么是热部署

应用正在运行的时候升级功能, 不需要重新启动应用 对于Java应用程序来说, 热部署就是在运行时更新Java类文件
好处:不需要重新手工启动应用,提高本地开发效率

常见实现热部署的方式

  • Jrebel
  • Spring Loaded
  • spring-boot-devtools

下面是使用: spring-boot-devtools

操作步骤:
pom.xml文件中需要添加:

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

  <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.bootgroupId>
                <artifactId>spring-boot-maven-pluginartifactId>
                <configuration>
                    <fork>truefork>
                configuration>
            plugin>
        plugins>
    build>

添加好之后设置IDEA:
File->Settings>Build, Execution, Deployment > Compiler

IDEA中SpringBoot2.X热部署Dev-tool和常见问题_第1张图片点击Apply就好了

使用快捷键打开,选择Registry

注意默认快捷键:
window快捷键 Shift+Ctrl+Alt+/
mac快捷键 Shift+Command+Alt+/
如果自行修改了默认快捷键,则百度搜索相关博文,或者还原快捷键设置

如下图:IDEA中SpringBoot2.X热部署Dev-tool和常见问题_第2张图片
选择compiler.automake.allow.when.app.running ,重启idea就行!!!
(往下翻找一下 打上对勾)
IDEA中SpringBoot2.X热部署Dev-tool和常见问题_第3张图片

你可能感兴趣的:(SpringBoot,spring,boot,开发工具)