using Spring 3.2.0.M1 and integration 2.1.3....
Trying to set up a publish-subscribe channel with annotations. Idea is to wrap a couple CRUD services with an AOP @Around and send of in a message the service name in the header plus the object effected by the CRUD call in the payload. Can't get the @Publisher annotation to fire off a message, looking like the post processor isn't been run.
Testing with JUnit so the Test class has:
The ApplicationConfig has the AOP @Around bean wired:Code:@ContextConfiguration(classes = { ApplicationConfig.class, DevelopmentConfig.class, ProductionConfig.class }, loader = AnnotationConfigSDNContextLoader.class)
And in the DevelopmentConfig (got my profile set to "development") the actual Publication-Subcribe channel named "crudElementChannel":Code:@Bean public ElementCRUD elementCRUD() { return new ElementCRUD(); }
Inside the AOP ElementCrud class I have the @Around aspect method which gets called after the proceed call it calls the "send" method in the same class:Code:@Bean public PublishSubscribeChannel crudElementChannel() { return new PublishSubscribeChannel(); }
Read that the PublisherAnnotationBeanPostProcessor has to be added to the BeanFactory so I extended the AnnotationConfigContextLoader as:Code:@Publisher(channel = "crudElementChannel") public Element send(@Payload Element element, @Header String function) { .... return element; }
Got "Advisor is null" error if the afterPropertiesSet method wasn't run with the passed beanFactory.Code:@Override protected void customizeBeanFactory(DefaultListableBeanFactory beanFactory) { PublisherAnnotationBeanPostProcessor integrationPABPP = new PublisherAnnotationBeanPostProcessor(); integrationPABPP.setBeanFactory(beanFactory); integrationPABPP.afterPropertiesSet(); beanFactory.addBeanPostProcessor(integrationPABPP); }


Reply With Quote
