spring-projects / spring-projects/spring-data-examples

Example for Spring Data JDBCs Crud Repository with multiple datasources

Open
#544 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
5.4k
Forks
3.4k
PR merge metrics
No merged PRs in 30d

Description

Hello together,

we may all knows that we can set up to a JDBCTemplate a Datasource, so a JDBCTemplate knows which datasource it has: JDBCTemplate JdbcTemplate = new JDBCTemplate(dataSource)

Whats about with a CrudRepository ? How can a CrudRepository knows to which database it should communicate to ? It is using the default one, all time. If we setup a second database in Configuration, a CrudRepositry will use the first and primary one.

Is there an example of using CrudRepository with two databases ? I can't find one in web.

I post it also in stack overflow here

Thank you.

Contributor guide

No contributing guide indexed for this repository

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 reviewing the existing Spring Data JDBC example projects and their datasource configuration, then trace how CrudRepository is connected to a datasource. Done means the repository contains a clear example showing CrudRepository usage with two databases and explaining which datasource each repository uses.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, databases, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.