springboot热部署

热部署是在服务器运行时重新部署项目,直接加载整个应用,会释放内存,不过比较耗时

配置tomcat实现热部署

有三种方式

方式一

把项目web文件放在webapps目录下

方式二

在tomcat\conf\server.xml中的<host>标签内添加<context>标签

<context debug="0" docBase="项目路径" path="访问路径" privileged="true" reloadable="true"></context>

方式三

在tomcat\conf\catalina\localhost中添加一个项目的xml

<context docBase="项目路径" reloadable="true"></context>

会使用xml文件的名字作为访问路径

springboot实现热部署

方式一

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>springloaded</artifactId>
  <version>1.2.8.RELEASE</version>
</dependency>

使用该依赖需要使用maven方式启动,因为这是属于maven插件中的依赖

mvn springboot:run

方式二

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-devtools</artifactId>
  <version>2.1.6.RELEASE</version>
  <scope>provided</scope>
  <optional>true</optional>
</dependency>

https://zhhll.icu/2021/框架/springboot/基础/7.springboot热部署/

本文由 mdnice 多平台发布

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部