BAEL-3832: added setters and getters and changed the testcases accordingly
This commit is contained in:
+11
-4
@@ -1,14 +1,21 @@
|
||||
package com.baeldung.ioccontainer.bean;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
|
||||
public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
|
||||
public static boolean isBeanInstantiated = false;
|
||||
private static boolean isBeanFactoryPostProcessorRegistered = false;
|
||||
|
||||
@Override
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
isBeanInstantiated = true;
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory){
|
||||
setBeanFactoryPostProcessorRegistered(true);
|
||||
}
|
||||
|
||||
public static boolean isBeanFactoryPostProcessorRegistered() {
|
||||
return isBeanFactoryPostProcessorRegistered;
|
||||
}
|
||||
|
||||
public static void setBeanFactoryPostProcessorRegistered(boolean isBeanFactoryPostProcessorRegistered) {
|
||||
CustomBeanFactoryPostProcessor.isBeanFactoryPostProcessorRegistered = isBeanFactoryPostProcessorRegistered;
|
||||
}
|
||||
}
|
||||
|
||||
+11
-4
@@ -1,14 +1,21 @@
|
||||
package com.baeldung.ioccontainer.bean;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
|
||||
public class CustomBeanPostProcessor implements BeanPostProcessor {
|
||||
public static boolean isBeanInstantiated = false;
|
||||
private static boolean isBeanPostProcessorRegistered = false;
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
isBeanInstantiated = true;
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName){
|
||||
setBeanPostProcessorRegistered(true);
|
||||
return bean;
|
||||
}
|
||||
|
||||
public static boolean isBeanPostProcessorRegistered() {
|
||||
return isBeanPostProcessorRegistered;
|
||||
}
|
||||
|
||||
public static void setBeanPostProcessorRegistered(boolean isBeanPostProcessorRegistered) {
|
||||
CustomBeanPostProcessor.isBeanPostProcessorRegistered = isBeanPostProcessorRegistered;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
package com.baeldung.ioccontainer.bean;
|
||||
|
||||
public class Student {
|
||||
public static boolean isBeanInstantiated = false;
|
||||
private static boolean isBeanInstantiated = false;
|
||||
|
||||
public void postConstruct() {
|
||||
isBeanInstantiated = true;
|
||||
setBeanInstantiated(true);
|
||||
}
|
||||
|
||||
public static boolean isBeanInstantiated() {
|
||||
return isBeanInstantiated;
|
||||
}
|
||||
|
||||
public static void setBeanInstantiated(boolean isBeanInstantiated) {
|
||||
Student.isBeanInstantiated = isBeanInstantiated;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user