File tree 2 files changed +31
-16
lines changed
2 files changed +31
-16
lines changed Original file line number Diff line number Diff line change 1
1
# springboot-multiple-dataSources
2
- spring-boot多数据源自动切换例子项目
3
2
4
- 这个项目用到了通用mapper
3
+ ### 前言 ###
4
+
5
+ spring-boot多数据源自动切换例子项目, 利用spring aop 切面,自动切换数据源。
6
+
7
+ CommonServiceImpl是公共处理类,Test1ServiceImpl和Test2ServiceImpl是两个数据源分别的业务处理类。定义DataSourceAspect类处理切面。
8
+
9
+ springboot-multiple-dataSources/src/main/resources目录下的database1.sql和database2.sql是2个数据源初始化脚本
10
+
11
+ ### 软件环境 ###
12
+ IntelliJ IDEA 2016.3.3(或eclipse)
13
+
14
+ jdk 1.8
15
+
16
+ maven 3.3.9
17
+
18
+ ### 使用的技术 ###
19
+
20
+ - spring-boot
21
+ - springmvc
22
+ - mybatis
23
+ - 通用mapper(一个非常好用的mybatis插件, 详细介绍见http://git.oschina.net/free/Mapper )
24
+
25
+ ### 在IDE 中查看源码并运行 ###
26
+
27
+ ** 1. 在IntelliJ IDEA (推荐使用)**
28
+
29
+ File -> Import Project -> select springboot-multiple-dataSources folder -> create project form existing sources -> ...
30
+
31
+ ** 2. 在Eclipse**
32
+
33
+ File -> Import -> Existing Maven Projects -> ...
Original file line number Diff line number Diff line change 75
75
<groupId >org.springframework.boot</groupId >
76
76
<artifactId >spring-boot-starter-freemarker</artifactId >
77
77
</dependency >
78
-
79
- <!-- 上传文件-->
80
- <dependency >
81
- <groupId >commons-fileupload</groupId >
82
- <artifactId >commons-fileupload</artifactId >
83
- <version >1.3.1</version >
84
- </dependency >
85
-
86
78
<!-- mysql-->
87
79
<dependency >
88
80
<groupId >mysql</groupId >
115
107
<scope >compile</scope >
116
108
<optional >true</optional >
117
109
</dependency >
118
- <!-- 分页插件-->
119
- <dependency >
120
- <groupId >com.github.pagehelper</groupId >
121
- <artifactId >pagehelper</artifactId >
122
- <version >${pagehelper.version} </version >
123
- </dependency >
124
110
<!-- 通用Mapper-->
125
111
<dependency >
126
112
<groupId >tk.mybatis</groupId >
You can’t perform that action at this time.
0 commit comments