[ 
https://issues.apache.org/jira/browse/CAMEL-11476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068024#comment-16068024
 ] 

ASF GitHub Bot commented on CAMEL-11476:
----------------------------------------

GitHub user zregvart opened a pull request:

    https://github.com/apache/camel/pull/1797

    CAMEL-11476: spring-boot - routes not loaded when setting a management.port

    @nicolaferraro would you mind taking a look, thanks 👍 
    
    Fixes `RouteBuilder` (Java DSL) based routes not loading when setting 
`management.port` Spring Boot property by removing the 'same application 
context' check.
    
    Also removes `maybeStart` method to start the Camel context from 
`RoutesCollector`, startup is now handled in `SpringCamelContext`.
    
    When customizing the `management.port` configuration option Spring Boot 
creates a new `ApplicationContext` instance which when started emits a 
`ContextRefreshedEvent` that is different from the `ApplicationContext` the 
`RoutesCollector` is initialized with.
    
    Due to change in CAMEL-11261, `SpringCamelContext` is started via the same 
`ContextRefreshedEvent`, at the point the second `ContextRefreshedEvent` emited 
from the `ApplicationContext`, that `RoutesCollector` is initialized with, 
`SpringCamelContext` is already started and no Java DSL routes are added to 
Camel context.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/zregvart/camel CAMEL-11476

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/1797.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1797
    
----
commit 3ab5ce9c61daf2d50f2f33ac78dfa189aa2cd1a8
Author: Zoran Regvart <[email protected]>
Date:   2017-06-29T08:42:07Z

    CAMEL-11476: spring-boot - routes not loaded wh...
    
    ...en setting a management.port
    
    Fixes `RouteBuilder` (Java DSL) based routes not loading when setting
    `management.port` Spring Boot property by removing the 'same application
    context' check.
    
    Also removes `maybeStart` method to start the Camel context from
    `RoutesCollector`, startup is now handled in `SpringCamelContext`.
    
    When customizing the `management.port` configuration option Spring Boot
    creates a new `ApplicationContext` instance which when started emits a
    `ContextRefreshedEvent` that is different from the `ApplicationContext`
    the `RoutesCollector` is initialized with.
    
    Due to change in CAMEL-11261, `SpringCamelContext` is started via the
    same `ContextRefreshedEvent`, at the point the second
    `ContextRefreshedEvent` emited from the `ApplicationContext`, that
    `RoutesCollector` is initialized with, `SpringCamelContext` is already
    started and no Java DSL routes are added to Camel context.

----


> spring-boot - routes not loaded when setting a management.port
> --------------------------------------------------------------
>
>                 Key: CAMEL-11476
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11476
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-spring-boot
>    Affects Versions: 2.20.0
>            Reporter: Nicola Ferraro
>            Assignee: Zoran Regvart
>             Fix For: 2.20.0
>
>
> This is a really weird bug. If you set:
> {code}
> management.port=8081
> {code}
> On the application.properties file of any spring-boot application using 
> actuator, then camel routes created through RouteBuilders are not loaded 
> ("Total 0 routes, of which 0 are started."). 
> I've found it in (all) the fabric8 basic quickstarts, but it happens also in 
> the "camel-example-spring-boot" bundled with Apache Camel. Everything works 
> in 2.19.x.
> Setting a different management port is a best practice. 
> [~zregvart], [[email protected]], [~lb] any idea?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to