一, 热部署
Spring Boot中模板引擎默认开启缓存,可在application.properties中关闭.
Spring Loaded: 可实现修改文件类的热部署.
vm args添加: - javaagent:C:\springloaded-1.2.3.RELEASE.jar -noverify
JRebel: 也可实现热部署,推荐, 但是为收费软件.
spring-boot-devtools: 也可以实现页面跟代码的热部署, 需添加依赖
<dependency>
<groupId>org.springframework.boot</groudId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
二, 常规部署
1, jar 形式
ant package
java -jar xx.jar
注册为linux服务
备注: Linux运行的软件我们通常把它注册为服务,这样可以通过命令开启关闭及保持开机启动等功能
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <executable>true</executable> </configuration> </plugin> </plugins> </build>
2, war形式
记得把pom.xml中的jar改为war
<packaging>war</packaging>
3, 云部署
三, Spring Boot 测试
@SpringApplicationConfiguration
依赖: spring-boot-starter-test