question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple datasources support [DATAJDBC-321]

See original GitHub issue

Marek Šabo opened DATAJDBC-321 and commented

As mentioned in the SO answer, spring-data-jdbc currently doesn’t support multiple datasources. It would be great to add this support in future releases.

Immediate help for advanced spring users would be making JdbcRepositoryFactoryBean constructor public. That way we could provide our own dependencies based on the context of datasource.

Next step could extending the @EnableJdbcRepositories annotation with refs/links to dependencies similar way the @EnableJpaRepositories does.

(In our multi-ds JPA project we use similar configuration to one outlined in this article: https://medium.com/@joeclever/using-multiple-datasources-with-spring-boot-and-spring-data-6430b00c02e7)


Affects: 1.1 M1 (Moore), 1.0.4 (Lovelace SR4)

Reference URL: https://stackoverflow.com/a/50197148/303559

Issue Links:

  • DATAJDBC-499 Register custom converters in two independent modules (“is duplicated by”)
  • DATAJDBC-622 Add support for transactionManagerRef in EnableJdbcRepository

14 votes, 15 watchers

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:13
  • Comments:11

github_iconTop GitHub Comments

5reactions
isimonovcommented, Jan 12, 2022

Hi! Are there plans to implement full support for multiple data sources? This functionality is very lacking.

2reactions
kota65535commented, Jul 5, 2021

Hi @SimSonic, your problem seems to be related to this issue, and you should annotate @Primary to the one of the JdbcConverter bean to specify which one you use like this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple datasources support [DATAJDBC-321] #544 - GitHub
Marek Šabo opened DATAJDBC-321 and commented As mentioned in the SO answer, spring-data-jdbc currently doesn't support multiple datasources.
Read more >
How to configure multiple datasources in Spring Data JDBC?
I'm trying to replace some projects to use Spring Data JDBC instead of using JdbcTemplate . Now, I'd like to use it for...
Read more >
Configure and Use Multiple DataSources in Spring Boot
In this tutorial, we'll learn how to configure and use multiple data sources with Spring Boot. To find out how to deal with...
Read more >
Multiple Data Sources with Spring Boot
How to configure Spring Data JPA to work with multiple,separate databases.Learn to set up multiple data sources with Spring Boot.
Read more >
Configuring multiple data sources with Spring Boot 2 and ...
But that's not the case with configuring multiple datasources. # Primary data source configuration spring.datasource-primary.url=jdbc:mysql://localhost:3306/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found