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

Claus Ibsen updated CAMEL-17932:
--------------------------------
    Fix Version/s: 3.x

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

Reply via email to