美文网首页IT必备技能
SpringBoot热部署与打包分布

SpringBoot热部署与打包分布

作者: c_gentle | 来源:发表于2020-06-27 22:50 被阅读0次

/**

  • DEBUG调试模式启动

  • 热部署配置过程:

    1. spring.thymeleaf.cache=false 关闭页面缓存
    1. 在xml中定义devtolls
  • <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    </dependency>

    在maven-plugin中增加
    <configuration>
    <fork>true</fork>
    </configuration>

    1. 修改idea的设置,如果是eclipse第三部可省略
      file->setting->build->complier->build project auto.... 勾选
      ctrl+shift+a 输入registry -》确保 complier.automake.... 被勾选(默认就是选中的)
      */

/**

  • jar包的配置
  • 1.利用 mvn package 打成jar
  • 2.利用java -jar xxx.jar 启动应用
  • 3.在同级目录下添加配置文件,应用生效
  • 4.在linux环境下利用 nohup java -jar xxx.jar >> xxx.log & 命令后台运行
  • 5.使用tail -f xxx.log 监控日志文件
    */

/**

  • War的配置

    1. package : jar -> war
    1. 增加pom ,在打包的时候不去加载内嵌tomcat的jar
  • <dependency>
    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-starter-tomcat</artifactId>
    //provided 在编译时这个Jar存在,但在打包和运行时,不将jar放到运行环境中
    //complie 在编译、运行。发布的时候jar包都存在,这是一个默认是
    //runtime 运行时,在本地编译时不用这个jar,在运行发布的时候将其加载放置到运行环境中
    <scope>provided</scope>
    </dependency>

    1. 原有入口类的main方法实效
      //SpringBootServletInitializer的作用就是在tomcat启动的时候,执行内置的configure方法,将其托管给Spring Boot
      */

相关文章

网友评论

    本文标题:SpringBoot热部署与打包分布

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