Docker deployment nacos reports No DataSource set exception

2023-11-04 16:07:12,865 ERROR Application run failed org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘memoryMonitor’ defined in URL [jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos- config-2.2.3.jar!/com/alibaba/nacos/config/server/monitor/MemoryMonitor.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘asyncNotifyService’: Unsatisfied dependency expressed through field ‘dumpService’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘externalDumpService’: Invocation of init method […]

dynamic-datasource+shardingsphere-jdbc realizes sub-database and sub-table

Project background On the basis of spring boot and dynamic-datasource realizing the separation of reading and writing of the database, the function of sub-database and table is added. 1. Framework version 1. Key technology stack versions <properties> <java.version>8</java.version> <snakeyaml.version>1.33</snakeyaml.version> </properties> <dependencies> <!– druid connection pool –> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.2.20</version> </dependency> <!–dynamic-datasource–> <dependency> <groupId>com.baomidou</groupId> <artifactId>dynamic-datasource-spring-boot-starter</artifactId> […]

MyBatis-Plus and Druid combine with Dynamic-datasource to realize multi-data source operation database

MyBatis-Plus official website: https://baomidou.com/ MyBatis-Plus official documentation: https://baomidou.com/pages/24112f/ dynamic-datasource documentation (paid): https://www.kancloud.cn/tracy5546/dynamic-datasource/2264611 Create database Here I created two databases: test1 and test2, and created data tables with the same structure User respectively. Of course, you can also Create data tables with different structures according to the actual situation: ——————————- –User table structure —————————- CREATE TABLE […]

jdbc data source (DruidDataSourceFactory) connection pool – druid

<dependencies> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.28</version> <scope>compile</scope> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.2.16</version> </dependency> </dependencies> 1. Druid data source connection pool technology package com.csdn.jdbc; import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.pool.DruidPooledConnection; import java.sql.SQLException; // Demonstrate data source connection pool druid Druid data source connection pool technology public class DataSourceConnectPool { public static void main(String[] args) throws SQLException { DruidDataSource dataSource […]

SpringBoot+ThreadLocal+AbstractRoutingDataSource implements dynamic switching of data sources

Hi, everyone, I am the fat boy who grabs my wife’s yogurt. Recently, when doing business requirements, I need to obtain data from different databases and then write them into the current database, so it involves switching data sources. Originally I wanted to use the dynamic data source SpringBoot starter provided in Mybatis-plus: dynamic-datasource-spring-boot-starter to […]

Use dynamic-datasource to complete multiple data source operations

This operation is to insert the data from Dameng database into the MySQL database. Preparation Create a Spring Boot project Add dependencies Configure data source properties POM file <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.32</version> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>dynamic-datasource-spring-boot-starter</artifactId> <version>3.5.2</version> </dependency> <!– Add dm8 jdbc jar package dependency –> <dependency> <groupId>com.dm</groupId> <artifactId>DmJdbcDriver</artifactId> <version>1.8.0</version> […]

[Springboot] Implement DynamicDataSource to configure multiple data sources – Part2

Foreword In the previous part, we implemented a simple dynamic multi-data source configuration. Please see the previous article for details: [Springboot] Implement DynamicDataSource to configure multiple data sources – Part1 As we said, at this time we can actually only manually modify the data source name to obtain other data sources before calling mapper. This […]

[Springboot] Implement DynamicDataSource to configure multiple data sources – Part1

Main requirements In a Springboot project, multiple data sources (connected to multiple different databases) need to be used. MybatisPlus is used as the persistence layer solution in the project. It needs to be similar to adding different annotations to a certain Mybatis Mapper, so that the mapper can connect to different data sources. As shown […]

Android Studio plays video and audio files and solves the project error java.lang.RuntimeException: java.io.IOException: setDataSource failed.

1: Use MediaPlayer to play audio files to achieve play, pause, and replay functions. 1. Create a new blank project MediaPlayer, create a new directory raw under res, and put music.mp3 into the raw directory, as shown in the following figure: 2.activity_main.xml Use linear layout LinearLayout, arrange vertically android:orientation=”vertical”, and place three buttons. The code […]

MyBatis-Plus multi-data source dynamic-datasource solves the problem of multi-data source Redis Key duplication

Article directory Preface 1. Redis Key solution: 2. Redis Key adds data source identification: 2.1 Customize the serialization of redis key: 2.2 Add serialization of redis key: Summarize Foreword When using dynamic-datasource, multiple tenants share a system, but the cache resources set by each tenant must be isolated, otherwise it will cause chaos in the […]