Skip to content

About

This is an example of automatically switching data sources for spring boot

Topics

Resources

Stars

125 stars

Watchers

18 watching

Forks

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

springboot-multiple-dataSources

前言

spring-boot多数据源自动切换例子项目, 利用spring aop 切面,自动切换数据源。

CommonServiceImpl是公共处理类,Test1ServiceImpl和Test2ServiceImpl是两个数据源分别的业务处理类。定义DataSourceAspect类处理切面。

springboot-multiple-dataSources/src/main/resources目录下的database1.sql和database2.sql是2个数据源初始化脚本

软件环境

IntelliJ IDEA 2016.3.3(或eclipse)

jdk 1.8

maven 3.3.9

使用的技术

在IDE 中查看源码并运行

1. 在IntelliJ IDEA (推荐使用)

File -> Import Project -> select springboot-multiple-dataSources folder -> create project form existing sources -> ...

2. 在Eclipse

File -> Import -> Existing Maven Projects -> ...

About

This is an example of automatically switching data sources for spring boot

Topics

Resources

Stars

125 stars

Watchers

18 watching

Forks

Releases

Packages

Used by

Contributors

Languages