1.查看接口实现类是否加入注解,如service.repository等 2.查看spring配置文件是否自动扫描包    <context:component-scan base-package="xxx.xx.xxx"> 3.查看是否在web.xml中加载spring容器 4.service是否有实现impl…
项目使用spring, mybatis.因为分了多个模块,所以会这个模块引用了其它模块的现在,结果使用Junit测试的时候发现有两个模块不能自动注入dao和service问题.解决后在此记录一下. 解决思路,一直以为是dao的xml文件的配置问题,通过日志查看,发现所有的dao与mapper.xml的文件都加载进来了.想着可能是maven包的问题,通过与可测试模块的pom文件对比,解决了这个bug. 异常主要信息: java.lang.IllegalStateException: Failed…
看具体报错日志: 警告: Unable to proxy interface-implementing method [public final void cn.wlf.selection.proto.ComponentShowService._ComponentShowService$ComponentShowService.callMethod(com.google.protobuf.Descriptors$MethodDescriptor,com.google.protobuf.RpcCo…
报错如下: NoSuchBeanDefinitionException:No qualifying bean of type   found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. 错误原因:bean注入失败 解决方法: 1.在配置文件中启动注解功能<mvc:annotation-driven/> 2.在配置文件中添加扫描目录<c…
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apiUserController': Unsatisfied dependency expressed through field 'api…
这个看起来很弱爆的问题其实是因为其他的配置文件中已经出现了为xx定义好的注入.如果用@Autowired就会得到上面的错误 , 但是用@Resource的时候就会看到类似下面的错误 Bean named 'moneyRecordDao' must be of type [com.fuscent.core.dao.MoneyRecordDao], but was actually of type [com.yooli.currentproduct.dao.impl.MoneyRecordDaoIm…
错误原因:没有引入相应mapper接口,导致spring没有找到依赖 解决方法一:使用注解的方法: 首先在spring配置文件中添加 <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">         <property name="basePackage" value="com.forum" />         <property na…
在搭建SSM spring springmvc  mybatis整合的时候, 遇到了这个问题 说说我的问题吧!我在进行单元测试的时候,出现了这个错误,网上一查才知道是,配置文件中没有写扫描包信息.一看加载的是spring.xml文件,就去这个文件中查找了. 这个错误是因为自动扫描包配置出错.无法自动注入类到容器中 <!--配置自动扫描的包,用于注解的扫描@Service @Controller--> <context:component-scan base-package="c…
spring中一个符号的错误居然让我浪费了四五个小时才找出来,不得不给自己了两个耳光.. 由于新建项目与原来项目的目录结构有所不同,copy过来的配置文件,有些地方修改的不彻底,导致spring扫描注解的时候,扫描不到,不能注入bean,导致运行出错.一个马虎浪费了这么多时间,符号这种问题也往往最容易忽视的.<context:component-scan base-package="com.oskyhang.*.service"/> <context:componen…