Struts2 +Spring 3.0+hibernate 3.3 注解异常.expected at least 1 bean which qualifies as autowir我用注解来实现的SSH,用@Entity 来标示实体bean,用 来让Spring 来注入,可以在service里面用@Autowired\x05\x05@Qualifier("taUser")\x0
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/26 01:18:13
![Struts2 +Spring 3.0+hibernate 3.3 注解异常.expected at least 1 bean which qualifies as autowir我用注解来实现的SSH,用@Entity 来标示实体bean,用 来让Spring 来注入,可以在service里面用@Autowired\x05\x05@Qualifier(](/uploads/image/z/14754332-20-2.jpg?t=Struts2+%2BSpring+3.0%2Bhibernate+3.3+%E6%B3%A8%E8%A7%A3%E5%BC%82%E5%B8%B8.expected+at+least+1+bean+which+qualifies+as+autowir%E6%88%91%E7%94%A8%E6%B3%A8%E8%A7%A3%E6%9D%A5%E5%AE%9E%E7%8E%B0%E7%9A%84SSH%2C%E7%94%A8%40Entity+%E6%9D%A5%E6%A0%87%E7%A4%BA%E5%AE%9E%E4%BD%93bean%2C%E7%94%A8+%E6%9D%A5%E8%AE%A9Spring+%E6%9D%A5%E6%B3%A8%E5%85%A5%2C%E5%8F%AF%E4%BB%A5%E5%9C%A8service%E9%87%8C%E9%9D%A2%E7%94%A8%40Autowired%5Cx05%5Cx05%40Qualifier%28%22taUser%22%29%5Cx0)
Struts2 +Spring 3.0+hibernate 3.3 注解异常.expected at least 1 bean which qualifies as autowir我用注解来实现的SSH,用@Entity 来标示实体bean,用 来让Spring 来注入,可以在service里面用@Autowired\x05\x05@Qualifier("taUser")\x0
Struts2 +Spring 3.0+hibernate 3.3 注解异常.expected at least 1 bean which qualifies as autowir
我用注解来实现的SSH,用@Entity 来标示实体bean,用 来让Spring 来注入,可以在service里面用@Autowired\x05
\x05@Qualifier("taUser")
\x05TaUser taUser;
来使用这个实体bean的时候就报下面这个错,说找不到,貌似Spring没注入耶.再次万谢各位帮忙解决下(据说是 3.0和3.3 jar 冲突,但是我不知道那个有冲突啊).
Unable to instantiate Action,com.ta.action.UserCreateAction,defined for 'user-create' in namespace '/'Error creating bean with name 'com.ta.action.UserCreateAction':Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:Could not autowire field:com.ta.service.UserServices com.ta.action.UserCreateAction.userServices; nested exception is org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'userServicesImpl':Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:Could not autowire field:com.ta.entity.model.TaUser com.ta.service.impl.UserServicesImpl.taUser; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:No matching bean of type [com.ta.entity.model.TaUser] 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),@org.springframework.beans.factory.annotation.Qualifier(value=taUser)}
\x05com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:318)
\x05com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:399)
Struts2 +Spring 3.0+hibernate 3.3 注解异常.expected at least 1 bean which qualifies as autowir我用注解来实现的SSH,用@Entity 来标示实体bean,用 来让Spring 来注入,可以在service里面用@Autowired\x05\x05@Qualifier("taUser")\x0
你这种写法,Spring根本就不知道你要注入那个实体,再说了,你也没有使用自动装配,要是你是Spring的话,你知道别人想要你注入什么东西?
多写几个属性:
收起