设置打包类型和打包名称
war
springboot-deploy
4.0.0 org.springframework.boot spring-boot-starter-parent 2.0.9.RELEASE com.example springboot-deploy 0.0.1-SNAPSHOT springboot-deploy springboot-deploy 1.8 war org.springframework.boot spring-boot-starter-web springboot-deploy org.springframework.boot spring-boot-maven-plugin
springboot 入口文件继承SpringBootServletInitializer类重写configure设置tomcat访问入口
@SpringBootApplication
public class SpringbootDeployApplication extends SpringBootServletInitializer {public static void main(String[] args) {SpringApplication.run(SpringbootDeployApplication.class, args);}@Overrideprotected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {return builder.sources(SpringbootDeployApplication.class);}
}
1.然后将其war包JavaWebTest.war复制粘贴到apache-tomcat-8.5\webapps\目录下(个人习惯,另外的目录理应也可以)
2、配置apache-tomcat-8.5\conf\server.xml文件
并找到节点添加下面的代码,如下:
3.访问路径:http://localhost:8080/car/