I have created a bugticket:
https://issues.apache.org/jira/browse/CAMEL-17492
Problem is the @Produce (EndpointInjection)
At the time of the CamelBeanPostProcessor kicks and tries to inject the
endpoint (Endpoint getEndpointInjection(...) but the camel context is null
and fails with this NPE

Only workaround we have is to downgrade do Camel 3.11


Am Mi., 12. Jan. 2022 um 19:12 Uhr schrieb Michael Rambichler <
mich...@rambichler.at>:

> Hi together,
>
> I am afraid but I think I have found a bug (Camel 3.13. and
> Springboot 2.6.x)
> 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
>
> Please can you check my approach. If everything is right I will create a
> bug ticket.
>
> 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
>
>
> 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);
> }
>
>
>

Reply via email to