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 2022/09/03 13:33:00 UTC

[jira] [Updated] (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 updated CAMEL-17932:
--------------------------------
    Summary: camel-spring-boot - EndpointInject happens before CamelContextConfiguration#beforeApplicationStart  (was: EndpointInject happens before CamelContextConfiguration#beforeApplicationStart)

> 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)