[
https://issues.apache.org/jira/browse/CAMEL-20352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen reassigned CAMEL-20352:
-----------------------------------
Assignee: Claus Ibsen
> camel.springboot.includeNonSingletons is not respected anymore: prototype
> Route Builders are always initialized.
> -----------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-20352
> URL: https://issues.apache.org/jira/browse/CAMEL-20352
> Project: Camel
> Issue Type: Bug
> Components: camel-spring-boot
> Affects Versions: 4.3.0
> Reporter: Yury Kartsev
> Assignee: Claus Ibsen
> Priority: Minor
>
> Some time ago a new property was added to Apache Camel in CAMEL-10421, called
> "includeNonSingletons". It was configured via
> "camel.springboot.includeNonSingletons" property. Now it looks like
> `org.apache.camel.main.DefaultRoutesCollector.collectRoutesFromRegistry`
> finds all RouteBuilder in its `findByType(camelContext,
> RoutesBuilder.class);` method, regardless of whether they're prototypes or
> not by calling Spring's
> .`org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(@Nullable
> Class<T> type)`, which hard-codes `includeNonSingletons` to `true`.
> In older Camel versions `org.apache.camel.spring.boot.RoutesCollector` class
> would run method `onApplicationEvent` and it would not touch prototypes due
> to this: "applicationContext.getBeansOfType(RoutesBuilder.class,
> configurationProperties.isIncludeNonSingletons(), true).values()".
> This issue causes our code to fail because we have a RouteBuilder prototype
> with only constructor to set URI and routeId dynamically for each builder.
> But we don't need Camel to do it automatically, because it does not know what
> to pass to that constructor.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)