@Test public void postProcessBeforeInitialization() { Subscriber subscriber = new Subscriber(); Object result = beanPostProcessor.postProcessBeforeInitialization(subscriber, "subscriber"); assertSame(subscriber, result); verify(eventBus).register(subscriber); }
@Override public Object postProcessBeforeInitialization(Object bean, String beanName) { try { if (eventBus == null) { eventBus = beanFactory.getBean(EventBus.class); } log.trace("registering potential event bus subscriber: {}", beanName); eventBus.register(bean); } catch (BeanCurrentlyInCreationException e) { } return bean; }
EventBusBeanPostProcessor implements DestructionAwareBeanPostProcessor { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) { try { if (eventBus == null) { eventBus = beanFactory.getBean(EventBus.class); } log.trace("registering potential event bus subscriber: {}", beanName); eventBus.register(bean); } catch (BeanCurrentlyInCreationException e) { } return bean; } }
EventBusBeanPostProcessor implements DestructionAwareBeanPostProcessor { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) { try { if (eventBus == null) { eventBus = beanFactory.getBean(EventBus.class); } log.trace("registering potential event bus subscriber: {}", beanName); eventBus.register(bean); } catch (BeanCurrentlyInCreationException e) { } return bean; } EventBusBeanPostProcessor(BeanFactory beanFactory); }
EventBusBeanPostProcessor implements DestructionAwareBeanPostProcessor { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) { try { if (eventBus == null) { eventBus = beanFactory.getBean(EventBus.class); } log.trace("registering potential event bus subscriber: {}", beanName); eventBus.register(bean); } catch (BeanCurrentlyInCreationException e) { } return bean; } EventBusBeanPostProcessor(BeanFactory beanFactory); @Override Object postProcessBeforeInitialization(Object bean, String beanName); @Override Object postProcessAfterInitialization(Object bean, String beanName); @Override void postProcessBeforeDestruction(Object bean, String beanName); }
EventBusBeanPostProcessor implements DestructionAwareBeanPostProcessor { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) { try { if (eventBus == null) { eventBus = beanFactory.getBean(EventBus.class); } log.trace("registering potential event bus subscriber: {}", beanName); eventBus.register(bean); } catch (BeanCurrentlyInCreationException e) { } return bean; } EventBusBeanPostProcessor(BeanFactory beanFactory); @Override Object postProcessBeforeInitialization(Object bean, String beanName); @Override Object postProcessAfterInitialization(Object bean, String beanName); @Override void postProcessBeforeDestruction(Object bean, String beanName);  }