Have been using the jar package run springboot project, a sudden impulse to want to run the war the way, did not think that there is a pit in it, record the following way about playing war springboot items:
1. The need to configure the startup class
@SpringBootApplication public class PhotoApplication extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(PhotoApplication.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder.sources(PhotoApplication.class); } }
First class inherits SpringBootServletInitializer and start rewriting configure method;
2. yml configuration file
And wherein the context-path names consistent war package
3. Static file structure
The most important is to start the top class configuration;
Then deployed to fight the war package normal tomcat ok, not much to say specific deployment method here, too simple, not the students themselves Baidu