前排提醒,這只是篇排錯日記,可能解決不了你的問題。
點擊右側查看tomcat日志
看這個報錯信息,知道是映射文件路徑出錯了。
改一下
然后又報新錯誤:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employeeController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.figsprite.Service.EmployeeService com.figsprite.Controller.EmployeeController.employeeService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.figsprite.Service.EmployeeService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
可以知道是掃描包出現問題, = =這里因為懶,直接復制了SpringMVC的配置文件,導致Spring掃描不到包了
= =還是錯
在控制層加點料
= =好熟悉的錯誤,剛學習SpringMVC時令人抓瘋的錯誤
= = 途中又碰到新問題
log4j:WARN No appenders could be found for logger
在web.xml里改一改
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/config/log4j.properties</param-value>
</context-param>
······
<!-- 定義LOG4J監聽器 -->
<listener>
<listener-class>
org.springframework.web.util.Log4jConfigListener
</listener-class>
</listener>
至此,整合SSM宣告成功!!!萬里長征,剛剛開始