spring-projects / spring-projects/spring-boot

Improve documentation showing how to use two different databases

Open
#3,456 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: documentation
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}.sql files to add data to two different test databases
  • use the datasources in repositories where we define simple an interface which extends from the CrudRepository interface
  • 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.