zoukankan      html  css  js  c++  java
  • SpringBoot热部署的两种方式

    SpringBoot热部署方式一共有两种,分别使用两种不同的依赖

      SpringBoot 1.3后才拥有SpringBoot devtools热部署

      ①:spring-boot-devtools   ②:Spring Loaded

      方式一:

        在项目的pom文件中添加依赖:

    1 <!--热部署jar-->
    2 <dependency>
    3     <groupId>org.springframework.boot</groupId>
    4     <artifactId>spring-boot-devtools</artifactId>
    5 </dependency>

        然后:使用 shift+ctrl+alt+"/" (IDEA中的快捷键) 选择"Registry" 然后勾选 compiler.automake.allow.when.app.running

      方式二:

        在项目中添加如下代码

        <build>
            <plugins>
                <plugin>
                    <!-- springBoot编译插件-->
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <dependencies>
                        <!-- spring热部署 -->
                        <!-- 该依赖在此处下载不下来,可以放置在build标签外部下载完成后再粘贴进plugin中 -->
                        <dependency>
                            <groupId>org.springframework</groupId>
                            <artifactId>springloaded</artifactId>
                            <version>1.2.6.RELEASE</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </build>            

        添加完毕后需要使用mvn指令运行:

        首先找到IDEA中的Edit configurations ,然后进行如下操作:(点击左上角的"+",然后选择maven将出现右侧面板,在红色划线部位输入如图所示指令,你可以为该指令命名(此处命名为MvnSpringBootRun))

        

        点击保存将会在IDEA项目运行部位出现,点击绿色箭头运行即可

        

  • 相关阅读:
    jQuery源码笔记——四
    jQuery源码笔记——三
    jQuery源码笔记——二
    深度理解作用域链和闭包
    事务的传播机制
    Jvm的运行时数据区
    SpringBoot 工程结构
    MyBatis的<if>标签判空
    Redis学习
    MyBatis调用Oracle的存储过程
  • 原文地址:https://www.cnblogs.com/wooyoohoo/p/9314628.html
Copyright © 2011-2022 走看看