Spring 整合mybatis 出现错误,求大神帮忙指点
两个项目是可以正常运行访问的,但是把项目A打成jar包引入到项目中,启动就报以下错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping#0' defined in URL [jar:file:/D:/workSpace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/app-enntry-web/WEB-INF/lib/eshore-khala-core-controller-1.0.0-SNAPSHOT.jar!/conf/spring/spring-mvc-pluginmgr.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'interfaceController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.eshore.backframe.backend.service.IUserService com.eshore.appentry.InterfaceController.userService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.eshore.backframe.backend.service.IUserService] 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)}
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.eshore.backframe.backend.service.IUserService com.eshore.appentry.InterfaceController.userService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.eshore.backframe.backend.service.IUserService] 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)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)
... 47 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.eshore.backframe.backend.service.IUserService] 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)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:993)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:863)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:775)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489)
... 49 more
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.eshore.backframe.backend.service.IUserService] 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)}
配置文件如下:
spring-mvc.xml:
<context:component-scan base-package="com.eshore" use-default-filters="false">
<context:include-filter expression="org.springframework.stereotype.Controller" type="annotation" />
<context:exclude-filter expression="org.springframework.stereotype.Service" type="annotation" />
<context:exclude-filter expression="com.eshore.backframe.backend.service.IUserService" type="annotation" />
</context:component-scan>
applicationContext.xml:
<context:component-scan base-package="com.eshore">
<context:exclude-filter expression="org.springframework.stereotype.Controller" type="annotation" />
<context:exclude-filter expression="com.eshore.backframe.backend.service.IUserService" type="annotation" />
</context:component-scan>
两个配置文件的beans节点下面都设置了default-autowire="byName" default-lazy-init="true"
网上找了很多类似的帖子都没解决,求各位大神指教以下,不甚感激
相关推荐
Spring/SpringMVC/MyBatis整合+事务回滚
Spring/SpringMVC/MyBatis整合,可事务回滚
spring boot整合mybatis连接不上数据库
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user ‘root’@‘localhost’ (using password: YES) spring boot中使用mybatis连接mysql数据库时报如上错误,确认配置文件中的密码没问题,但是一直报错,最后在密码上加双引号解决 ———————————————— 版权声明
spring boot整合mybatis-plus启动报错问题及解答.pdf
解决spring-boot整合mybatis-plus启动报错问题; Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2020-08-04 20:19:03.246 ERROR 18020 --- [ main] o.s.boot.SpringApplication : Application run failed
spring整合mybatis的jar_spring+mybatis_
使用spring+mybatis自动生成实体类工具包,部分错误解决方案等
mybatis与spring整合全部jar包
mybatis与spring整合全部jar包(包括springmvc)


Web 开发
