Spring Boot Multiple Datasources
HTML-код
- Опубликовано: 10 сен 2024
- This video explains how to configure multiple data sources in Spring Boot. We configure a weather forecast data source and a sport event datasource. Enjoy!
Link to the code:
github.com/eki...
Good tutotrial. Thank you very much. Keep uploading such type of videos.
I will. I'm currently playing with k8
Hi,
i have spring boot application with all the entities
but i want connect to databases dynamically, it means when i start my application the database not exist and then somebody create the database and connect the application in the runtime without changing the application.properties
thanks
Added to backlog
Solid tutorial. Thanks a lot.
Glad it was helpful! Thank you for watching. :)
Thanks a lot.
Glad to help
Hi Mike,
What is that .of() method can you please explain ?
Where in the vid to you see that? :)
@@MikesTechCorner Hey mike, I Understood, I saw the code, you have implemented an of() method
I want to update if there are any differences in data.is that possible??
You need to compare the fields in the java program or just save no matter if it is the same
@@MikesTechCorner I want to compare and update if data in other columns except primary key column is different,insert if primary key is not present. How can I compare data of two tables ??
Good tutorial Thanks, Question is that In one Db can have many tables which are actually entity and persistenceUnit is an entity also, how can we manage multiple persistenceUnit in a DBConfig class?
I actually don't know. :)
great video. How can I make an update to source A and then B and C also get updated? Souce A to be the center
I don't know and you should avoid multiple datasources in general. Have the master system of each database expose REST endpoints instead.
@@MikesTechCorner Thank you.
Hello , is possible to join the tables ? Like @OnetoMany ?
Thanks a lot .
Not between datasources. In that case you would create a service that selects from both datasources and then merge the result into 1 Java class.
could you please help us, how to configure spring boot with mysql & mongodb (or aws documentDB).. In addition to that please explain how to work with transaction on both databases.
A use case where a method updates both databases and rollback transaction if something goes wrong..
Yes
@@MikesTechCorner thanks for your quick response and I just updated mu original comment to add more details..plz have a look at it
@@SrikarRao i have added this to my to-do list. Its an interesting subject
@@MikesTechCorner, could you please notify me when you post new video with my request.
Here is what you requested: ruclips.net/video/qOfdE-cFzto/видео.html
thanks so much for your tutorial.
now i have question, if i have more than one entity in both datasource, what changes i need to do and where?
You just add the entities in the right packages. If you have an entity in both db's then create 2 classes. One in the package for db no 1 and one in the package for db no 2.
@@MikesTechCorner Nice, this works for me, i love you
Hello. Coud you please share the code?
Yes Ill look into it tomorrow
Hi Norberto. I have added a link with the code in the description field. Thanks for watching my video. github.com/ekim197711/springboot-multiple-datasources