You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2023/05/26 19:11:00 UTC

[jira] [Resolved] (CAMEL-17932) camel-spring-boot - EndpointInject happens before CamelContextConfiguration#beforeApplicationStart

     [ https://issues.apache.org/jira/browse/CAMEL-17932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-17932.
---------------------------------
    Resolution: Won't Fix

That low level spring IoC stuff happens sooner and this is not the intention of that callback api to let end users do all sort of stuff there. Frankly end users should seldom use that listener api that is spring boot specific

> camel-spring-boot - EndpointInject happens before CamelContextConfiguration#beforeApplicationStart
> --------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-17932
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17932
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-spring-boot, tests
>            Reporter: John Poth
>            Priority: Minor
>             Fix For: 3.x
>
>
> Currently something like this fails in camel-spring-boot tests:
> {code:java}
> @EndpointInject("mock:result")
> MockEndpoint mock;
> @Test
> public void testComponentConfigured() {
>     // this fails
>     assertTrue(mock.isLog());
> }
> @Bean
> CamelContextConfiguration contextConfiguration() {
>     return new CamelContextConfiguration() {
>         @Override
>         public void beforeApplicationStart(CamelContext context) {
>             MockComponent mock = new MockComponent(context);
>             mock.setLog(true);
>             context.addComponent("mock", mock);
>         }
>         @Override
>         public void afterApplicationStart(CamelContext camelContext) {
>             //do nothing here
>         }
>     };
> }
> {code}
> This is because the wiring for *@EndpointInject* happens before *CamelContextConfiguration#beforeApplicationStart*. Workaround is to configure the component via @Bean



--
This message was sent by Atlassian Jira
(v8.20.10#820010)