@Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { try { return delegate.postProcessAfterInitialization(bean, beanName); } catch (Exception e) { // do not wrap already beans exceptions if (e instanceof BeansException) { throw (BeansException) e; } throw new GenericBeansException("Error post processing bean: " + beanName, e); } }
/** * Applies the {@link DefaultCamelBeanPostProcessor} to this instance. * * Derived classes using IoC / DI frameworks may wish to turn this into a NoOp such as for CDI * we would just use CDI to inject this */ protected void applyCamelPostProcessor() throws Exception { // use the default bean post processor from camel-core if the test class is not dependency injected already by Spring boolean spring = hasClassAnnotation("org.springframework.boot.test.context.SpringBootTest", "org.springframework.context.annotation.ComponentScan"); if (!spring) { DefaultCamelBeanPostProcessor processor = new DefaultCamelBeanPostProcessor(context); processor.postProcessBeforeInitialization(this, getClass().getName()); processor.postProcessAfterInitialization(this, getClass().getName()); } }