From a4e0ce1b2f1e30bdc061705445c0da461f64745d Mon Sep 17 00:00:00 2001 From: Jay Date: Tue, 31 Dec 2019 13:41:12 -0800 Subject: [PATCH] Readme Updates --- README.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 270e0e0..165afb8 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,8 @@ Initializr generates spring boot project with just what you need to start quickl Once you Generate and download the zip file, you should have similar POM file as: -```... +```xml + @@ -47,14 +48,15 @@ Once you Generate and download the zip file, you should have similar POM file as runtime - ... + -... + ``` for this demo I use HikariDataSource as a default connection pool library by Spring Boot 2.2.2 we need to have 2 separate DataSource and EntityManager one for the Writes(Master/Primary) and one for Reads(Slave/Secondary). -``` +```yaml + application.yml spring: datasource-write: @@ -85,7 +87,7 @@ spring: as you see I have 2 data-source as: datasource-write and datasource-read with their own credentials. DataSource Configurations for WriteDB: -``` +```java @Configuration @ConfigurationProperties("spring.datasource-write") @EnableTransactionManagement @@ -125,7 +127,7 @@ public class DataSourceConfigWrite extends HikariConfig { DataSource Configurations for ReadDB: -``` +```java @Configuration @ConfigurationProperties("spring.datasource-read") @EnableTransactionManagement @@ -171,7 +173,7 @@ Write: ```com.ehsaniara.multidatasource.repository.writeRepository``` Read: ```com.ehsaniara.multidatasource.repository.readRepository``` you also need to set: -``` +```java public final static String MODEL_PACKAGE = "com.ehsaniara.multidatasource.model"; public final static Properties JPA_PROPERTIES = new Properties() {{ @@ -183,7 +185,7 @@ public final static Properties JPA_PROPERTIES = new Properties() {{ ``` and the actual logic are in the service layer: -``` +```java @Service public class CustomerServiceImpl implements CustomerService {