Hi Robert.
Declarative services are best way ... but i need to use different datasources starting from a (request) payload attribute received from a servlet ... So I decided to migrate (in a bundle service)  the custom pool engine that we used in the old webapp.

Thanks.
Nicola.

Il 12/14/20 12:55 PM, Robert Munteanu ha scritto:
Hi Nicola,

On Fri, 2020-12-11 at 16:16 +0100, Nicola Cisternino wrote:
Hi all

I'm using Sling Datasource Bundle (org.apache.sling.datasource) and I
configured two entries named (datasource.name property): *source1*
and
*source2*.
I can select single datasource using DS annotations:

@Reference(target =
"(&(objectclass=javax.sql.DataSource)(datasource.name=*source1*))")
private DataSource dataSource;

But ... how can I select single datasource programmatically ?
How do you select the datasources programatically now?

As a side note, I'd try to stick to declarative services as much as
possible as it makes things simpler to write and understand.

Thanks,
Robert


Reply via email to