前排提醒,这只是篇排错日记,可能解决不了你的问题。
点击右侧查看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时令人抓疯的错误
= = 途中又碰到新问题
在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宣告成功!!!万里长征,刚刚开始
原文地址:https://www.cnblogs.com/figsprite/p/10886885.html