"找出其中id属性与属性同名的bean进行注入",id:就是你配置的类的id属性,这个在Spring中是唯一的。“属性”指的是需要引入id为某个值的类。比如说我要在A这个对象中注入id为b的B类的对象,则A中存在属性名字如: private B b;这样Spring的BeanFactory就会在自己的Map容器中根据id找到相应的对象,完成注入。希望说的能帮楼主理解。……
[/Quote],根据的就是你这个成员变量的名称,比如private A a,则这个a就是id。
注解本身就帮助省去了getter方法,不会用到setter方法吧..
[/Quote]
今天配了一下依赖注入注解 出了这个错 不知道常见不?还是新手 不知道怎么调 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
"找出其中id属性与属性同名的bean进行注入",id:就是你配置的类的id属性,这个在Spring中是唯一的。“属性”指的是需要引入id为某个值的类。比如说我要在A这个对象中注入id为b的B类的对象,则A中存在属性名字如: private B b;这样Spring的BeanFactory就会在自己的Map容器中根据id找到相应的对象,完成注入。希望说的能帮楼主理解。