BAEL-3832: Difference between BeanFactory and ApplicationContext completed
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
package com.baeldung.ioccontainer.bean;
|
||||
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
|
||||
public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
|
||||
static final Logger LOGGER = LogManager.getLogger(CustomBeanPostProcessor.class.getName());
|
||||
|
||||
@Override
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
LOGGER.info("BeanFactoryPostProcessor is Registered");
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.baeldung.ioccontainer.bean;
|
||||
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
|
||||
public class CustomBeanPostProcessor implements BeanPostProcessor {
|
||||
|
||||
static final Logger LOGGER = LogManager.getLogger(CustomBeanPostProcessor.class.getName());
|
||||
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
LOGGER.info("BeanPostProcessor is Registered Before Initialization");
|
||||
return bean;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.baeldung.ioccontainer.bean;
|
||||
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class Student {
|
||||
static final Logger LOGGER = LogManager.getLogger(Student.class.getName());
|
||||
|
||||
public void postConstruct() {
|
||||
LOGGER.info("Student Bean is initialized");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user