Description
Improvement suggestion: If there are more than one datasource available, the method shall return the primary datasource, or none if there is no primary datasource.
DefaultAutowiredLifecycleStrategy#autwire() does not return any datasource from the spring context if there are more than one datasource in the spring context.
This improvement will mitigate the following inconvenience: When adding a second datasource, e.g. by external XML spring bean configuration, the existing SQL endpoints not having a datasource parameter stopped using the default spring datasource and failed at runtime.
This problem was very hard to come by, as there is no obvious reason or message, why the former datasource still present in the context is no longer used. Defining the main spring.datasource as @Primary did not resolve the problem.
Attachments
Issue Links
- is related to
-
CAMEL-16862 Camel-Sql: Endpoint DataSource option no longer overrides DataSource set by ComponentCustomerizer
- Closed
-
CAMEL-10618 camel-sql - Allow to use Spring Boot DataSource
- Resolved
- relates to
-
CAMEL-20050 camel-spring - Add support for @Primary spring bean autowiring
- Resolved
-
CAMEL-20048 camel-core - Find single bean by type should use consistent method
- Resolved