MENU

Fun & Interesting

Spring Data JPA [PRO] - How to connect Multiple Databases using Spring Boot | Multiple Datasources

Selenium Express 28,279 lượt xem 12 months ago
Video Not Working? Fix It Now

In this Spring Data JPA tutorial, we will learn, How to connect Multiple Databases using Spring Boot. We will be using a MySQL database and a Postgres database and create datasources for the same. As we will be creating multiple datasources for our application, We also need to set up multiple EntityManager for our application as well. Not only that, this tutorial covers setting up multiple transaction managers for our entity managers and helps you link them using @EnableJpaRepositories annotation. Mark that this is an important spring data jpa annotation as it helps creating the Repository implementation.

We will pull all the above together by creating a spring boot application which will continuously push data to multiple databases. You can use the same in your real-time project irrespective of the databases you are using. (Incase you have a h2 /d2/oracle/sql server db)

Timestamp
——————
00:00:00 - Sprig Data Jpa - Video Insights
00:03:45 - Spring Data jpa project setup
00:05:45 - The goal - Connect with Multiple databases
00:08:05 - Creating Product Entity
00:11:37 - Spring Data Jpa CrudRepository
00:18:18 - DatasourceProperties : Component walkthrough
00:19:52 - Setting up mysql datasource using application.properties
00:28:09 - Customising datasource properties
00:32:24 - Postgres datasource properties configuration
00:38:24 - spring boot @ConfgurationProperties - use case 1
00:44:46 - @Configuration with @Bean - use case 2
00:49:40 - DriverManagerDatasource vs DatasourceProperties’s initalizeDatasourceBuilder
00:57:02 - Multiple datasources in action with @Primary
01:13:19 - Setting up multiple entity managers
01:26:49 - @EnableJpaRepoistories : tech walkthrough
01:43:12 - Setting up multiple jpa transaction managers (PlatformTransctionManger)
01:54:55 - Success: Multiple datasource in action
01:56:58 - Best practice - @EnableTransactionManager
01:57:37 - [Test] check in data to multiple database with a spring boot app
02:00:37 - Outro

#springboot #springdatajpa #jpa #hibernate

For more free/paid courses visit
https://www.seleniumexpress.com

LINKS AND FREE LEARNING RESOURCES
========
Watch my new mock interview series for java developers
https://youtu.be/yX2w-Sof95s

Watch my new Hello spring boot series
https://youtu.be/F_rGkDeihBg?si=AvqLgRVvytkhy8lq

Watch Spring boot Hot topics
https://youtu.be/CUQWZHjuq-w

Java Interview / Question and Answer series
https://youtu.be/Y1uGGTrBYKw

Explain spring Bean Lifecycle
https://youtu.be/hUYGGqoXEPc

spring core
https://www.youtube.com/watch?v=r2Q0Jzl2qMQ&list=PL3NrzZBjk6m-nYX072dSaGfyCJ59Q5TEi

spring mvc
https://www.youtube.com/watch?v=zCHrZdJODg4&list=PL3NrzZBjk6m-OSeL3DRMD_ISa0u-9c1l1

spring mvc intermediate
https://www.youtube.com/watch?v=40YaLHbrwrY&list=PL3NrzZBjk6m_2jw8sC0BkEwSPFHxgQDWr

Spring JDBC
https://www.youtube.com/watch?v=5j_vh1b9dV8&list=PL3NrzZBjk6m-rYTKze-5Y5RvU8eykal4j

spring live project
https://www.youtube.com/watch?v=m_b_FwDjAXM&list=PL3NrzZBjk6m-9CVPueDLLermojwtfuW_f

SPRING SECURITY COURSE[NEW]
https://youtu.be/NMNLozLGT1s

For more courses visit
https://www.seleniumexpress.com

Any time you are getting stuck with issues, Feel free to ask for support.
You can send mail to seleniumexpress@gmail.com

you can ping me on my Facebook page
https://www.facebook.com/seleniumexpress

Make sure to join my private Facebook page (Ask me here)
“SeleniumExpress - Support"
https://www.facebook.com/groups/187000222361579/

you can ask for support in my website forum
https://www.seleniumexpress.com

Subscribe to my youtube channel

https://www.youtube.com/channel/UCpUYkSDJpHug-vfC5S-NXRA?sub_confirmation=1

Follow me on Insta
https://www.instagram.com/selenium_express/

Comment