Autowired au printemps

/* Can be done in 3 ways */

/* As class properties or Field Injection*/
class A {
	
    @Autowired
	private DIInjectable depInj;
    
    public doSomething(){
     	this.depInj.initiate();
      	// Rest of the code
      	// ...
    }
  
  	...
}

/* In constructor - Constructor Injection*/
class A {
  
  	private DIInjectable depInj;
  	
  	@Autowired
  	public A(DIInjectable depInj){
      this.depInj = depInj;
    }
  
  	public doSomething(){
      this.depInj.initiate();
      // Rest of the code
      // ...
    }
  
  	...
}
    
/* Setter Injection*/
class A {
  
  	private DIInjectable depInj;
  	
	...
    
    @Autowired
	public void setDiInjectable(DIInjectable depinj){
      this.depInj = depInj;
    }
  
  
  	public doSomething(){
      this.depInj.initiate();
      // Rest of the code
      // ...
    }
  
  	...
}
Tense Tarantula