idea 打包springboot项目报错:404

1、

 在本地的idea中,我们必须通过context-path(这里是volkswagen)+controller中的路径名访问项目,但是打包后,就不需要这个context-path,需要的是war包名+controller路径访问的形式

2、在测试类上,需要添加@Ignore不让maven将我么的测试类中的内容打成war包。

3、在启动类中,继承SpringBootServletInitializer类,并重写以下方法

//打成war包启动方式
protected SpringApplicationBuilder configure(
SpringApplicationBuilder builder)
{

return builder.sources(DemoApplication.class);
}

猜你喜欢

转载自www.cnblogs.com/yuxifly828/p/9838255.html