码迷,mamicode.com
首页 > 其他好文 > 详细

后台常见报错处理

时间:2017-09-08 18:35:57      阅读:248      评论:0      收藏:0      [点我收藏+]

标签:service   names   /tmp   source   control   vax   ring   注入   实体类   

1、接口注入问题:

@Controller
@Scope("prototype")
public class GenuineManagementAction extends BaseAction {

    private static final long serialVersionUID = -3797612994929924322L;

    @Resource
    private GenuineManagementService genuineManagementService;
    @Resource//这样写是有问题的,去掉即可正常
    private GenuineManagement genuineManagement;

}
  @Resource代表注入,只有接口才能注入,而GenuineManagement 是一个实体类,所以加上@Resource 会报如下错误:
Unable to instantiate Action, genuineManagementAction, 
No matching bean of type [com.vrv.paw.domain.GenuineManagement] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency.
Unable to instantiate Action, genuineManagementAction,  defined for genuineManagementAction_listUI in namespace /Error creating bean with name genuineManagementAction: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.vrv.paw.domain.GenuineManagement] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(mappedName=, shareable=true, description=, name=, type=class java.lang.Object, authenticationType=CONTAINER, lookup=)} - action - file:/E:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp4/wtpwebapps/JJFX/WEB-INF/classes/struts-extend.xml:420:89
    at com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:318)

2、

后台常见报错处理

标签:service   names   /tmp   source   control   vax   ring   注入   实体类   

原文地址:http://www.cnblogs.com/goloving/p/7495036.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!