- 改pom.xml
<packaging>war</packaging>
- 改启动类,增加注解,继承SpringBootServletInitializer,重写configure
//增加exclude = { DataSourceAutoConfiguration.class }
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
//继承SpringBootServletInitializer
public class DemoApplication extends SpringBootServletInitializer {
//重写configure方法
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(DemoApplication.class);
}
public static void main(String[] args)
{
SpringApplication.run(DemoApplication.class, args);
}
}