SpringApplicationBuilder:
该方法的作用是可以把项目打包成war包
需要配置启动类,pom.xml文件等,具体见:
@SpringBootApplication public class FavoritesApplication extends SpringBootServletInitializer{ /** * 如此配置打包后可以用tomcat下使用 * @param application * @return */ @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(FavoritesApplication.class); } public static void main(String[] args) { SpringApplication.run(FavoritesApplication.class, args); } }