I\'m learning Spring 3 and I don\'t seem to grasp the functionality behind
and
.
Only resolves the @Autowired
and @Qualifer
annotations, that's all, it about the Dependency Injection, There are other annotations that do the same job, I think how @Inject
, but all about to resolve DI through annotations.
Be aware, even when you have declared the
element, you must declare your class how a Bean anyway, remember we have three available options
Now with
It does two things:
does.Therefore if you declare
, is not necessary anymore declare
too.
Thats all
A common scenario was for example declare only a bean through XML and resolve the DI through annotations, for example
We have only declared the beans, nothing about
and
, the DI is configured in their own classes through @Autowired. It means the Services use @Autowired for their Repositories components and the Repositories use @Autowired for the JdbcTemplate, DataSource etc..components