scott miles wrote:In most of the sites and books i have read two types os injection in spring that is
1)Constructor injection
2)Setter injection
As per my understanding autowiring is also a type of injection only. Is n't it? am i missing something here.
No, you're right. You're thinking too low level on how Spring does DI. It does it either though XML and Annotations. In XML, yes you do it through constructor or setter. In Annotations, you use @Autowired or other similar tags to wire other spring beans. So even at Annotation level you're either injecting through constructor or setter. Yes, you can use Annotation on constructor.
In annotation @Autowired through setter is like
@Autowired
private A a;
through constructor is like
public B(@Autowired a){
this.a = a;
}
Hope this make sense.