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/05/09 17:32:52
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(

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的话,你知道别人想要你注入什么东西?

多写几个属性:





收起