FS1360472174 / javaweb

java learning
8 stars 4 forks source link

Spring annoation #14

Open FS1360472174 opened 8 years ago

FS1360472174 commented 8 years ago

注解是怎么实现的,如何自定义注解

FS1360472174 commented 8 years ago

http://www.ibm.com/developerworks/cn/opensource/os-cn-spring-iocannt/

FS1360472174 commented 8 years ago

一个类中有@Autowired 类字段, 如果它不是被autowired的。而是new 来实例化的。为什么@Autowired 类的成员变量就会失败

FS1360472174 commented 8 years ago

1.expected single matching bean but found 2:

http://stackoverflow.com/questions/8414287/spring-autowiring-with-unique-beans-spring-expected-single-matching-bean-but-fo

通过去掉@component解决的。但是实际中并没有通过XML或其他方式进行装配