Skip to content

Example for Spring Data JDBCs Crud Repository with multiple datasources #544

@kle-dev

Description

@kle-dev

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions