Giter VIP home page Giter VIP logo

springboot-multiple-datasources-oracle-mysql-mongodb's Introduction

springboot-multiple-dataSources-oracle-mysql-mongodb

前言

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

涉及到数据源有:两个mysql库,两个oracle库,两个mongodb库。

两个mysql库,两个oracle库处理:

CommonServiceImpl是公共处理类,

Test1ServiceImpl和Test2ServiceImpl是两个mysql 数据源分别的业务处理类, Test3ServiceImpl和Test4ServiceImpl是两个oracle 数据源分别的业务处理类, 。定义DataSourceAspect类处理切面。

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

两个mongodb库处理: OneMongoTemplateConf和TwoMongoTemplateConf 分别是两个mongodb数据的配置,定义不同的MongoTemplate。 WelcomeController 类使用时用@Qualifier 注解指定使用哪个数据库的MongoTemplate

软件环境

IntelliJ IDEA 2018.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 -> ...

springboot-multiple-datasources-oracle-mysql-mongodb's People

Contributors

2451315061 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.