Michael Rambichler created CAMEL-17492:
------------------------------------------

             Summary: CamelBeanPostProcessor fails if @Producer is used in 
EventNotifier
                 Key: CAMEL-17492
                 URL: https://issues.apache.org/jira/browse/CAMEL-17492
             Project: Camel
          Issue Type: Bug
    Affects Versions: 3.14.0, 3.13.0, 3.12.0
         Environment: {{TestEventNotifier.java}}

 

{{@Component}}
{{public class TestEventNotifier extends EventNotifierSupport {}}

{{   @Produce("stream:out")}}
{{   TestProducer producer;}}

{{   @Override}}
{{   public void notify(CamelEvent event) throws Exception {}}
{{      System.err.println(event);}}
{{      //producer.publish("some notification");}}
{{   }}}
{{}}}

{{---------------------------------------------------}}

{{TestProducer.java:}}

{{import org.apache.camel.InOnly;}}

{{@InOnly}}
{{public interface TestProducer {}}
{{   void publish(String event);}}
{{}}}
            Reporter: Michael Rambichler


If you use a @Produce annotation in an EventNotifier Camel fails at startup.


*Reproducable with:* Custom EventNotifier in a plain Camel + Springboot 
Routebuilder.
I have reproduced it with the spring boot example: 
[https://github.com/apache/camel-spring-boot-examples/tree/main/spring-boot] 
and added the EventNotifier below.
 
Fails since Camel > 3.11
 
Initialization of bean failed; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error post processing 
bean: testEventNotifier; nested exception is java.lang.NullPointerException
....
Caused by: org.springframework.beans.factory.BeanCreationException: Error post 
processing bean: testEventNotifier; nested exception is 
java.lang.NullPointerException
at 
org.apache.camel.spring.spi.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:160)
 ~[camel-spring-3.14.0.jar:3.14.0]
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:440)
 ~[spring-beans-5.3.14.jar:5.3.14]
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
 ~[spring-beans-5.3.14.jar:5.3.14]
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
 ~[spring-beans-5.3.14.jar:5.3.14]
... 122 common frames omitted



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to