Skip to content

Commit eb26b04

Browse files
committed
Java:新增多个数据库连接池(Druid+HikariCP)的 Demo,名为 APIJSONBoot-MultiDataSource
1 parent aee3d3f commit eb26b04

27 files changed

+3367
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ APIJSON-Java-Server/APIJSONDemo/.idea
1111

1212
*.iml
1313
APIJSON-Java-Server/APIJSONDemo-HikariCP/.settings
14+
APIJSON-Java-Server/APIJSONBoot-MultiConnectionPool/.settings
15+
APIJSON-Java-Server/APIJSONBoot-MultiDataSource/.settings
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# APIJSONBoot
2+
3+
APIJSON + SpringBoot 接近成品的 Demo
4+
5+
### 运行
6+
7+
右键 DemoApplication > Run As > Java Application
8+
9+
### 自定义 API 的说明(非 APIJSON 万能 API)
10+
https://github.com/xlongwei/light4j/tree/master/apijson#apijson%E8%B4%A6%E6%88%B7%E7%AE%A1%E7%90%86
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>apijson.boot</groupId>
7+
<artifactId>apijson-boot-multi-datasource</artifactId>
8+
<version>4.7.0</version>
9+
<packaging>jar</packaging>
10+
11+
<name>APIJSONBoot-MultiDataSource</name>
12+
<description>Demo project for APIJSON Server based on SpringBoot</description>
13+
14+
<properties>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
17+
<java.version>1.8</java.version>
18+
</properties>
19+
20+
<dependencies>
21+
<!-- APIJSON 需要用的依赖库,1.2.0 以上 -->
22+
<dependency>
23+
<groupId>com.alibaba</groupId>
24+
<artifactId>fastjson</artifactId>
25+
<version>1.2.74</version>
26+
</dependency>
27+
28+
<!-- apijson-framework 需要用的依赖库,4.0.0 以上 -->
29+
<dependency>
30+
<groupId>javax.servlet</groupId>
31+
<artifactId>javax.servlet-api</artifactId>
32+
<version>4.0.1</version>
33+
</dependency>
34+
35+
<!-- 单元测试:可使用 libs 目录的 unitauto-java.jar 和 unitauto-jar.jar 来替代,两种方式二选一
36+
<<<<<<<<< -->
37+
<dependency>
38+
<groupId>com.github.TommyLemon</groupId>
39+
<artifactId>unitauto-java</artifactId>
40+
<version>2.6.0</version>
41+
</dependency>
42+
<dependency>
43+
<groupId>com.github.TommyLemon</groupId>
44+
<artifactId>unitauto-jar</artifactId>
45+
<version>2.6.1</version>
46+
</dependency>
47+
<dependency>
48+
<groupId>io.github.classgraph</groupId>
49+
<artifactId>classgraph</artifactId>
50+
<version>4.8.87</version>
51+
</dependency>
52+
<!-- 单元测试:可使用 libs 目录的 unitauto-java.jar 和 unitauto-jar.jar 来替代,两种方式二选一 >>>>>>>>> -->
53+
54+
55+
<!-- 可使用 libs 目录的 apijson-orm.jar, apijson-framework.jar, apijson-column.jar 来替代,两种方式二选一 <<<<<<<<<< -->
56+
<dependency>
57+
<groupId>com.github.Tencent</groupId>
58+
<artifactId>APIJSON</artifactId>
59+
<version>4.7.0</version>
60+
</dependency>
61+
<dependency>
62+
<groupId>com.github.APIJSON</groupId>
63+
<artifactId>apijson-framework</artifactId>
64+
<version>4.7.0</version>
65+
</dependency>
66+
<dependency>
67+
<groupId>com.github.APIJSON</groupId>
68+
<artifactId>apijson-column</artifactId>
69+
<version>1.1.0</version>
70+
</dependency>
71+
<!-- 可使用 libs 目录的 apijson-orm.jar, apijson-framework.jar, apijson-column.jar 来替代,两种方式二选一 >>>>>>>>>> -->
72+
73+
<!-- 需要用的数据库 JDBC 驱动 -->
74+
<dependency>
75+
<groupId>mysql</groupId>
76+
<artifactId>mysql-connector-java</artifactId>
77+
<version>8.0.22</version>
78+
</dependency>
79+
<dependency>
80+
<groupId>org.postgresql</groupId>
81+
<artifactId>postgresql</artifactId>
82+
<version>42.2.18</version>
83+
</dependency>
84+
<dependency>
85+
<groupId>net.sourceforge.jtds</groupId>
86+
<artifactId>jtds</artifactId>
87+
<version>1.3.1</version>
88+
</dependency>
89+
<!-- Oracle, SQLServer 等其它数据库的 JDBC 驱动,可以在这里加上 Maven 依赖或 libs 目录放 Jar 包并依赖 -->
90+
<!-- 数据库 JDBC 驱动 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->
91+
92+
93+
<!-- APIJSONBoot 需要用的 SpringBoot 框架,1.4.0 以上 -->
94+
<dependency>
95+
<groupId>org.springframework.boot</groupId>
96+
<artifactId>spring-boot-starter-web</artifactId>
97+
<version>2.4.2</version>
98+
</dependency>
99+
100+
<!-- 需要用的 HikariCP 数据库连接池库,3.1.0 以上 -->
101+
<dependency>
102+
<groupId>com.zaxxer</groupId>
103+
<artifactId>HikariCP</artifactId>
104+
<version>3.1.0</version>
105+
</dependency>
106+
107+
<!-- 需要用的 Druid 数据库连接池库,1.0.29 以上 -->
108+
<dependency>
109+
<groupId>com.alibaba</groupId>
110+
<artifactId>druid</artifactId>
111+
<version>1.0.29</version>
112+
</dependency>
113+
114+
</dependencies>
115+
116+
<build>
117+
<plugins>
118+
<plugin>
119+
<groupId>org.springframework.boot</groupId>
120+
<artifactId>spring-boot-maven-plugin</artifactId>
121+
</plugin>
122+
<plugin>
123+
<groupId>org.apache.maven.plugins</groupId>
124+
<artifactId>maven-compiler-plugin</artifactId>
125+
<configuration>
126+
<source>1.8</source>
127+
<target>1.8</target>
128+
</configuration>
129+
</plugin>
130+
</plugins>
131+
</build>
132+
133+
<!-- Allow access to Spring milestones and snapshots -->
134+
<!-- (you don't need this if you are using anything after 0.5.0.RELEASE) -->
135+
<repositories>
136+
<!-- APIJSON 必须用到的托管平台 -->
137+
<repository>
138+
<id>jitpack.io</id>
139+
<url>https://jitpack.io</url>
140+
<snapshots>
141+
<enabled>true</enabled>
142+
</snapshots>
143+
</repository>
144+
145+
<repository>
146+
<id>spring-snapshots</id>
147+
<url>http://repo.spring.io/snapshot</url>
148+
<snapshots>
149+
<enabled>true</enabled>
150+
</snapshots>
151+
</repository>
152+
<repository>
153+
<id>spring-milestones</id>
154+
<url>http://repo.spring.io/milestone</url>
155+
<snapshots>
156+
<enabled>true</enabled>
157+
</snapshots>
158+
</repository>
159+
</repositories>
160+
<pluginRepositories>
161+
<pluginRepository>
162+
<id>spring-snapshots</id>
163+
<url>http://repo.spring.io/snapshot</url>
164+
</pluginRepository>
165+
<pluginRepository>
166+
<id>spring-milestones</id>
167+
<url>http://repo.spring.io/milestone</url>
168+
</pluginRepository>
169+
</pluginRepositories>
170+
171+
</project>

0 commit comments

Comments
 (0)