@Resource是按ByName自动注入,BeanFactory查找容器中全部bean,找出其中id属性与属性同名的bean进行注入。
对于这句不是很懂 "找出其中id属性与属性同名的bean进行注入" ,谁能详细说说,用一小段代码解释下最好!谢谢...
对于这句不是很懂 "找出其中id属性与属性同名的bean进行注入" ,谁能详细说说,用一小段代码解释下最好!谢谢...
解决方案 »
- 项目中加入dwr comet后,前端选项卡请求后台变慢或不请求了
- HibernateHelper的问题~~
- 关于在Servlet中调用EJB 3 stateless session bean的问题
- 一个ORM问题.最基本的,如何实现两个模型类的一对多/多对一映射.
- Could not synchronize database state with session
- tomcat的配置问题,与apache整合也不行
- java web start 如何访问ejb(高分求救!急急急!)
- 怎么进入各分类社区啊?
- 如何用java實現將一個文件拷貝到另外一個指定的地方呢﹖謝謝﹗
- 谁能给个ant的下载地址?谢谢!
- hibernate 存入数据时会覆盖掉原来外键中的数据
- 在myeclipse里运行netbeans桌面应用程序报错,求解?
<bean id="customDAO" class="com.softeem.crm.dao.impl.CustomDAOImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="customService" class="com.softeem.crm.service.impl.CustomServiceImpl">
<property name="customDAO" ref="customDAO"></property>
</bean>
比如说这两个,就可以根据ID进行注入。
其中,每一对bean标签中的id,在其class中有对应的熟悉名称。
请说一下 没有setter方法 他是怎么给属性赋值的
牛逼,打错了,是不需要用到getter方法。多谢纠正。
org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'saveStudentAction': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentDaoImpl' defined in file [D:\java\apache-tomcat-6.0.13\webapps\SSHStudentManager\WEB-INF\classes\com\dao\impl\StudentDaoImpl.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'studentServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentDaoImpl' defined in file [D:\java\apache-tomcat-6.0.13\webapps\SSHStudentManager\WEB-INF\classes\com\dao\impl\StudentDaoImpl.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'studentDaoImpl' defined in file [D:\java\apache-tomcat-6.0.13\webapps\SSHStudentManager\WEB-INF\classes\com\dao\impl\StudentDaoImpl.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
Caused by: java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required