1. 程式人生 > >Application startup failed org.springframework.beans.factory.BeanDefinitionStoreException

Application startup failed org.springframework.beans.factory.BeanDefinitionStoreException

最近使用了spring boot開發專案,但是對這個框架的瞭解不深,現在把每次遇到的坑發出來作為記錄。

錯誤

Application startup failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.tjr.supervisory.system.SupervisorySystemApplication]; nested exception is org.springframework.core.NestedIOException: Failed to
load class [javax.servlet.ServletContextListener]; nested exception is java.lang.ClassNotFoundException: javax.servlet.ServletContextListener

解決方式
註釋掉這段gradle程式碼 ,記得好像是之前匯出war包時候用的。 (provided表明該包只在編譯和測試的時候用!)
providedRuntime(‘org.springframework.boot:spring-boot-starter-tomcat:1.5.9.RELEASE’)

然後就可以運行了