Maven 升级sprint boot 后出现错误:
从sprint boot 2.1.0 升级到sprint boot 2.3.6
Multiple markers at this line
- The type javax.servlet.ServletContext cannot be resolved. It is indirectly referenced from required .class
files
- The type javax.servlet.ServletException cannot be resolved. It is indirectly referenced from
required .class files
解决办法:
更改pom.xml中的配置,添加javax.servlet
需要加provided
产生的原因是:tomcat中也有servlet-api包,这样发生了冲突
因为provided表明该包只在编译和测试的时候用,所以,当启动tomcat的时候,就不会冲突了.