1. 程式人生 > >maven專案執行出錯

maven專案執行出錯

Failed to detect ServletContainerInitializers for context with name [/seckill] java.io.IOException: java.lang.ClassCastException: Cannot cast org.springframework.web.SpringServletContainerInitializer to javax.servlet.ServletContainerInitializer

由此可以看出是web配置版本出錯,pom.xml中配置如下:

在這裡插入圖片描述 更改為 在這裡插入圖片描述 即可改變錯誤,可見:.provided(已提供範圍) provided意味著打包的時候可以不用包進去,別的設施(Web Container)會提供。事實上該依賴理論上可以參與編譯,測試,執行等週期。相當於compile,但是在打包階段做了exclude的動作