commit 5c2291d6a8ce77ddee20dcc8c6aeef22ed4bcc8e Author: 冯凯 <371894675@qq.com> Date: Sun Nov 19 09:35:03 2023 +0800 init datasource 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..c15ad8c --- /dev/null +++ b/pom.xml @@ -0,0 +1,58 @@ + + + + com.dragon + dragon-common + 3.6.3 + + 3.6.3 + 4.0.0 + + dragon-common-datasource + + + dragon-common-datasource多数据源 + + + + + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + + + com.baomidou + dynamic-datasource-spring-boot-starter + ${dynamic-ds.version} + + + + + + dragon-release + dragon-releases + http://10.100.1.7:8081/repository/maven-releases/ + + + + + dragon-public + dragon-maven + http://10.100.1.7:8081/repository/maven-public/ + + + public + aliyun nexus + http://10.100.1.7:8081/repository/maven-releases/ + + true + + + + diff --git a/src/main/java/com/dragon/common/datasource/annotation/Master.java b/src/main/java/com/dragon/common/datasource/annotation/Master.java new file mode 100644 index 0000000..425b839 --- /dev/null +++ b/src/main/java/com/dragon/common/datasource/annotation/Master.java @@ -0,0 +1,18 @@ +package com.dragon.common.datasource.annotation; + +import com.baomidou.dynamic.datasource.annotation.DS; + +import java.lang.annotation.*; + +/** + * 主库数据源 + * + * @author dragon + */ +@Target({ElementType.TYPE, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@DS("master") +public @interface Master { + +} diff --git a/src/main/java/com/dragon/common/datasource/annotation/Slave.java b/src/main/java/com/dragon/common/datasource/annotation/Slave.java new file mode 100644 index 0000000..5b208ba --- /dev/null +++ b/src/main/java/com/dragon/common/datasource/annotation/Slave.java @@ -0,0 +1,18 @@ +package com.dragon.common.datasource.annotation; + +import com.baomidou.dynamic.datasource.annotation.DS; + +import java.lang.annotation.*; + +/** + * 从库数据源 + * + * @author dragon + */ +@Target({ElementType.TYPE, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@DS("slave") +public @interface Slave { + +}