In Spring 3.X does a class have to be annotated as component in order to Autowire a field into it?
Let's say I have:
@Service("myBean")
public class Mybean {
}
public class Target {
@Autowired
@Qualifier("myBean")
private MyBean;
}
And then in my beans.xml
<context:component-scan base-package="com.package.beans" />
Where MyBean.java
is within com.package.beans.MyBean package
.
Does the class Target
have to be annotated as @Component
or some other spring annotation in order to autowire one of it's fields?