Friday 18 March 2011

Annotation approach for constructor injection

To do this we simply have to use @Autowired at the constructor, and @Repository as usual over the bean.

package annotations;
@Repository
public class FlightRepositoryImpl {


private DataSource dataSource;

@Autowired
public void FlightRepositoryImpl (DataSource dataSource) {
this.dataSource = dataSource;
}
}

No comments:

Post a Comment