`
weipeng1986
  • 浏览: 7034 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

在写使用springMVC时所犯低级错误

阅读更多
写后台的时候报错bean创建错误,
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ufpSettWageIFiledCfgController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.risencn.govhr.unifiedpay.genericwageinterface.service.FiledCfgService com.risencn.govhr.unifiedpay.genericwageinterface.controller.UfpSettWageIFiledCfgController.filedCfgService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.risencn.govhr.unifiedpay.genericwageinterface.service.FiledCfgService] 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)}
然后使用修改配置文件内容
    <context:component-scan base-package="com.risencn.govhr.*" />
以为扫描的有问题修改了下,指定到我写的包
<context:component-scan base-package="com.risencn.govhr.unifiedpay.*" />
问题依旧。
然后以为tomcat的子文件webapps部署的有问题,clean了下,问题依旧。
排除这两种后,有点苦恼,然后忍着困惑,再看注解位置---这是第n遍看,此时恍然大悟,made,注解写在interface上了--够2了,前面几次看真粗心,开发流程还是记得不牢靠。把service层的注解修改到相应的实现类上面,重新启动tomcat,ok。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics