springboot的项目本机启动没有问题,但是用tomcat去启动打出来的war包会报错。
报错信息为:
No WebApplicationContext found: no ContextLoaderListener registered?
经过断点可以看到是ServletContext.getAttribute("org.springframework.web.context.WebApplicationContext.ROOT")
获取结果为null
问题最后发现是启动类添加了abstract标识,删掉就好了,但仍不知道是什么原因,希望有大神指点