zoukankan      html  css  js  c++  java
  • Spring boot 热部署

    springloader

    1,在pom.xml文件创建节点并且添加依赖包:
          <build>
              <plugins>
               <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin </artifactId>
                 <dependencies>  
                  <!--springloaded  hot deploy -->  
                  <dependency>  
                      <groupId>org.springframework</groupId>  
                      <artifactId>springloaded</artifactId>  
                      <version>1.2.4.RELEASE</version>
                  </dependency>  
               </dependencies>  
               <executions>  
                  <execution>  
                      <goals>  
                          <goal>repackage</goal>  
                      </goals>  
                      <configuration>  
                          <classifier>exec</classifier>  
                      </configuration>  
                  </execution>  
               </executions>
                 </plugin>
         </plugins>
      </build>
     
     
    运行方式1,
    点击项目,
    run 右击,run as ==> maven build
    Goals 添加sring-boot:run
    可能会tomcat端口占用
     
    运行方式2,run as Java Application
    点击程序入口(main函数)
    添加VM 配置参数,就不会占用端口
    把spring-loader-1.2.4.RELEASE.jar下载下来,放到项目的lib目录中,然后把IDEA的run参数里VM参数设置为:
    -javaagent:.libspringloaded-1.2.4.RELEASE.jar -noverify
     
     
    springlaoder 热部署缺点:当代码修改的时候,热部署不会生效
     
    springboot + devtools(热部署)
    原理:底层由两个classLoader 类,一个classLoader 加载不会改变的jar包,一个classLoader去加载更改的类,成为restart classLoader,有代码更改之后,会重新启动应用。
    devtools 会监视classpath 下的文件变动
     
    开发工具的 build Automatically 需要打开 
     
    1,pom 添加依赖
    <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-devtools</artifactId>
                <optional>true</optional>
               <scope>true</scope>
    </dependency> 

    2,添加spring-boot-maven-plugin:<这个可以加可以不加>

    <build>
      <plugins>
          <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <configuration>
                 <!--fork :  如果没有该项配置,肯呢个devtools不会起作用,即应用不会restart -->
                     <fork>true</fork>
                 </configuration>
             </plugin>
      </plugins>
    </build>
     
     
     
  • 相关阅读:
    jython resources
    Installing a Library of Jython ScriptsPart of the WebSphere Application Server v7.x Administration Series Series
    jython好资料
    ulipad install on 64bit win7 has issue
    an oracle article in high level to descibe how to archtichre operator JAVA relevet project
    table的宽度,单元格内换行问题
    Linux常用命令大全
    dedecms系统后台登陆提示用户名密码不存在
    登录织梦后台提示用户名不存在的解决方法介绍
    Shell常用命令整理
  • 原文地址:https://www.cnblogs.com/pickKnow/p/10496104.html
Copyright © 2011-2022 走看看