DEV Community

loizenai
loizenai

Posted on

How to configure multi Postgres DataSources with Springboot

https://grokonez.com/java-integration/configure-multi-postgres-datasources-springboot

How to configure multi Postgres DataSources with Springboot

In the tutorial, JavaSampleApproach will guide you how to configure multi Postgres DataSources with Spring Boot.

I. Technologies for Multi Postgres Datasources tutorial

– Java 1.8
– Maven 3.3.9
– Spring Tool Suite – Version 3.8.1.RELEASE

II. Overview

1. Project Structure

springboot configure multi postgres datasources

  • Model: Customer.java
  • Dao Layer: CustomerDao.java is an interface and CustomerDaoImpl.java is an implementation of CustomerDao.java.
  • DataSource: Configured in DataSourceBeans.java
  • application.properties: used to define properties of data sources.

2. Step to do

  • Create SpringBoot project.
  • Setup Postgres Databases.
  • Configure Datasource properties in application.properties file.
  • Create a Model class.
  • Build Dao Layer.
  • Build a Client.

III. Practice

1. Create SpringBoot project.

Open Spring Tool Suite, on main menu, choose File->New->Spring Starter Project, input project's info.

More at:

https://grokonez.com/java-integration/configure-multi-postgres-datasources-springboot

How to configure multi Postgres DataSources with Springboot

Top comments (0)