Spring Core - BeanPostProcessor - Example
In Spring framework, the BeanPostProcessor is an interface that contains two callback methods: postProcessBeforeInitialization and postProcessAfterInitialization . BeanPostProcessor allows custom modification of new bean instances that are created by Spring Bean Factory. If we want to implement some custom logic such as checking for marker interfaces or wrapping beans with proxies after the Spring container finishes instantiating, configuring, and initializing a bean by plugging in one or more BeanPostProcessor implementations. As we mentioned earlier, BeanPostProcessor consists of two callback methods: 1. postProcessBeforeInitialization : We can call this method to apply any custom logic (such as InitializingBean's afterPropertiesSet or a custom init-method) to the given new bean instance before any bean initialization callbacks. 2. postProcessAfterInitialization : We can call this method to apply any custom logic (such as InitializingBean's af...