Hello,
Been doing my reading (swirling around right now) and can't fix my current issue.
I have 5 datasources, three of which I can fill in 100% through a property file. The other 2 I have everything but the db name at the end of the url.
(An aside: am I correct in reading that I therefore need 5 Transaction Managers? - If so will follow up with a new question
thread)
The schema is the same for db1 so no changes to rowmappers etc - just the db name (same principle for db2).
I came across
Dynamic DataSource Routing which I worked through and got working as I try and understand how Spring does things.
I got 'USING THE STEP EXECUTION CONTEXT AND PROMOTING THE DATA TO THE JOB EXECUTION CONTEXT' (Chapter 10 Spring Batch in Action) working by creating the db name in
TrackImportFromJobContextTasklet and retrieving it in VerifyStoreInStepContextTasklet.
I tweaked VerifyStoreInStepContextTasklet to see if I could set the udydb datasource url.
In launch-context I have
And the
gives
i.e. The datasource has not been instantiated yet (I think).
The next section in the book 'WRITING IN THE JOB EXECUTION CONTEXT AND READING USING LATE BINDING' won't work as in a different step.
So I am wrong in my thinking about the datasource and I think the code in VerifyStoreInStepContextTasklet breaches the whole separation of concerns?
I like the Dynamic Datasource Routing but can't figure out how to assign the db name which has been determined from an earlier step in the batch.
Any help appreciated. Thanks