[
https://issues.apache.org/jira/browse/CAMEL-8226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14313783#comment-14313783
]
Claus Ibsen commented on CAMEL-8226:
------------------------------------
Well spotted, in fact the code is a bit wrong as the endpoint options should
overrule the component configured, the correct code would be
{code}
// endpoint options overrule component configured datasource
DataSource ds = resolveAndRemoveReferenceParameter(parameters,
"dataSource", DataSource.class);
String dataSourceRef = getAndRemoveParameter(parameters,
"dataSourceRef", String.class);
if (ds == null && dataSourceRef != null) {
ds = CamelContextHelper.mandatoryLookup(getCamelContext(),
dataSourceRef, DataSource.class);
}
if (ds == null) {
// fallback and use component
ds = dataSource;
}
if (ds == null) {
throw new IllegalArgumentException("DataSource must be configured");
}
{code}
> Deprecated feature dataSourceRef not working correctly
> ------------------------------------------------------
>
> Key: CAMEL-8226
> URL: https://issues.apache.org/jira/browse/CAMEL-8226
> Project: Camel
> Issue Type: Bug
> Components: camel-sql
> Affects Versions: 2.14.1
> Reporter: Benjamin Graf
> Assignee: Claus Ibsen
> Fix For: 2.14.2, 2.15.0
>
>
> If several sql endpoints are defined using dataSourceRef attribute the latest
> one will not get dataSourceRef removed in createEndpoint causing validation
> exception.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)