赞
踩
springboot共有两种部署方式,一种是jar包,一种是war包
第一步:修改pom.xml的打包方式为jar,打包
第二部运行: java -jar 打好了的jar包名.jar ,如果想修改配置,后面跟 --server.port=8282,配置方式是--加上application里面的属性=配置的值
第一步: 去除内置的
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<artifactId>spring-boot-starter-tomcat</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
</exclusions>
</dependency>
为了方便本地运行测试,可以去掉spring-boot-starter-web内置的tomcat,在引入私有的tomcat,只在测试内用
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>
第二步:新增web.xml,特别重要
第三步:在启动类上继承SpringBootServletInitializer,重写下面方法:
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder springApplicationBuilder){
return springApplicationBuilder.sources(AppSaComprehensiveInspectionApplication.class);
}
第四步:修改pom.xml的打包方式为war,打包发布
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。