spring-projects / spring-projects/spring-boot
Improve documentation showing how to use two different databases
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
It would be nice to get a working example, how to use and configure two databases in spring boot.
The documentation says, that it is only required to create a datasource configuration with two different datasources.
But this does not work complete. The example application can show how to:
- define and use different
data-${platform}.sqlfiles to add data to two different test databases - use the datasources in repositories where we define simple an interface which extends from the
CrudRepositoryinterface - create a test case where data will be written into one datasource and read from another and then mix the result into a controller to deliver both data (via REST for example) to the client
I have not found any "complete" example for this. But it is mentioned in the documentation, that this is easy and supported by spring-boot .. so it would be nice to have such example.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Spring Boot documentation example application and the sections covering multiple DataSources. Build the example around separate data-${platform}.sql files, CrudRepository-based repositories, a test that writes to one datasource and reads from another, and a controller exposing the combined result. Done means the documentation contains a complete, working two-database example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- backend, databases, documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100