@Component(value = "customBeanName") public class CustomComponentBean implements BeanPostProcessor{ @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException{ System.out.println("\033[37;7m" + "postProcessAfterInitialization" + "\033[0m"); System.out.println("beanName = " + beanName); return BeanPostProcessor.super.postProcessAfterInitialization(bean, beanName); } @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException{ System.out.println("\033[37;7m" + "postProcessBeforeInitialization" + "\033[0m"); System.out.println("beanName = " + beanName); return BeanPostProcessor.super.postProcessBeforeInitialization(bean, beanName); } }