In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the springboot multi-data source configuration does not take effect how to do, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
According to the problem of multiple data source switching encountered when synchronizing data, according to the pit encountered when the source configuration does not take effect, configure the configuration that the data source is not loaded when the yml file is found to be started. * * spring:datasource:db1:driver-class-name:xxxxxxxurl:jdbc:xxxxxxxusername:rootpassword:111111db2:driver-class-name:xxxxxxurl:xxxxxxusername:rootpassword:111111
Wait, wait, wait.
Every configuration has been checked, there is no mistake, and it has been right several times. I tossed about for a long time.
Solution
The format in the yml configuration file is not aligned. The db1 db2 db3 should be on the same column.
The compiler does not have any hints and will not be loaded with an extra space or misalignment.
Trample SpringBoot configuration multiple data sources, cyclic reference problem
Recently, using SpringBoot to configure AOP dynamic data source, which is achieved by inheriting the class AbstractRoutingDataSource, reported an error when using it, as follows
It is probably that dynamicDataSource depends on dataSourceScxys, dataSourceScxys depends on DataSourceInitializerInvoker, and DataSourceInitializerInvoker depends on dynamicDataSource, resulting in a circular reference. When Spring initializes bean, you don't know which one to initialize first.
Solution.
Exclude the automatic configuration class of springboot when it starts, as follows
Thank you for reading this article carefully. I hope the article "what if the springboot multi-data source configuration does not take effect" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.