SpringBoot 部署 war 文件至 tomcat 后出现
2018-06-14 本文已影响16人
8e744d4a988c
解决方法:
新建类 ServletInitializer
(名字随便取):
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(XiaoMaWebsiteApplication.class);
}
}
然后重新打包成 war 部署即可。