From e7cec7024929f20882a2ccaccf8ab0298ce69d58 Mon Sep 17 00:00:00 2001 From: ZhangXushuo <3508242435.com> Date: Thu, 26 Oct 2023 22:35:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 46 +++++++++++++ pom.xml | 66 +++++++++++++++++++ .../common/datasource/annotation/Master.java | 22 +++++++ .../common/datasource/annotation/Slave.java | 22 +++++++ 4 files changed, 156 insertions(+) create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 src/main/java/com/february/common/datasource/annotation/Master.java create mode 100644 src/main/java/com/february/common/datasource/annotation/Slave.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..09bdfea --- /dev/null +++ b/.gitignore @@ -0,0 +1,46 @@ +###################################################################### +# Build Tools + +.gradle +/build/ +!gradle/wrapper/gradle-wrapper.jar + +target/ +!.mvn/wrapper/maven-wrapper.jar + +###################################################################### +# IDE + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### JRebel ### +rebel.xml +### NetBeans ### +nbproject/private/ +build/* +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ + +###################################################################### +# Others +*.log +*.xml.versionsBackup +*.swp + +!*/build/*.java +!*/build/*.html +!*/build/*.xml \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..3c512e3 --- /dev/null +++ b/pom.xml @@ -0,0 +1,66 @@ + + + + com.february + february-common + 3.6.3 + + 4.0.0 + 3.6.3 + february-common-datasource + + + february-common-datasource多数据源 + + + + + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + + + com.baomidou + dynamic-datasource-spring-boot-starter + ${dynamic-ds.version} + + + + + + public + aliyun nexus + https://maven.aliyun.com/repository/public + + true + + + + + + public + aliyun nexus + https://maven.aliyun.com/repository/public + + true + + + false + + + + + + + maven-releases + maven-releases + http://10.100.1.6:8081/repository/maven-releases/ + + + diff --git a/src/main/java/com/february/common/datasource/annotation/Master.java b/src/main/java/com/february/common/datasource/annotation/Master.java new file mode 100644 index 0000000..dd3d171 --- /dev/null +++ b/src/main/java/com/february/common/datasource/annotation/Master.java @@ -0,0 +1,22 @@ +package com.february.common.datasource.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import com.baomidou.dynamic.datasource.annotation.DS; + +/** + * 主库数据源 + * + * @author february + */ +@Target({ ElementType.TYPE, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@DS("master") +public @interface Master +{ + +} diff --git a/src/main/java/com/february/common/datasource/annotation/Slave.java b/src/main/java/com/february/common/datasource/annotation/Slave.java new file mode 100644 index 0000000..7d272a4 --- /dev/null +++ b/src/main/java/com/february/common/datasource/annotation/Slave.java @@ -0,0 +1,22 @@ +package com.february.common.datasource.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import com.baomidou.dynamic.datasource.annotation.DS; + +/** + * 从库数据源 + * + * @author february + */ +@Target({ ElementType.TYPE, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@DS("slave") +public @interface Slave +{ + +}