0

How Spring able to read or implement the Annotations called @Autowired, @Component and where the logic available in spring source code?

2 Answers 2

2

Spring context understand annotation by set of classes which implements bean post processor interface. so to handle different type of annotation we need to add different annotation bean post processors.

if you add in you configuration xml then you need not to add any annotation bean post processors.

Post processor provide methods to do pre and post processing for each bean initialization. you can write your own bean post processors to do custom processing by created a bean which implements BeanPostProcessor interface.

0

Annotations are metadata that can be read from the java source code. Spring Container understands what has to be done when it encounters these annotations in a source file.

Read through on each of these annotations.

More on Autowiring

1.4.5. Autowiring Collaborators

The following class does the autowiring magic.

AutowiredAnnotationBeanPostProcessor

Not the answer you're looking for? Browse other questions tagged or ask your own question.