Exact Meaning of BeanpostProcessor in Spring

A  BeanPostProcessor gives you a chance to process an instance of a bean created by the IoC container after it’s instantiation and then again after the initialization and before the intialization of lifecycle event has occurred on the instance.

 

BeanPostProcessors and any beans they depend on are instantiated before any other beans in the container. After they are instantiated and ordered, they are used to process all the other beans as they are instantiated by the IoC container. Spring’s different AOP proxies for caching, transactions, etc. are all applied by BeanPostProcessors. So, any BeanPostProcessor you create isn’t eligible for AOP proxies. Since AOP proxies are applied this way, it’s possible an AOP proxy may not yet have been applied to the instance so care should be taken if this will affect any post processing being done.

 

 

 

Advertisements

Spring Annotations

SpringAnnotations:

  1. @Required
  2. @Autowired
  3. @Qualifier
  4. @Transactional
  5. @Scope

JSR-250 Annotations:

  1. @Resource (or) @Resource(name=” “)
  2. @PostConstruct
  3. @PreDestroy

Stereo Type Annotations:

  1. @Service
  2. @Repository
  3. @Component
  4. @Controller