本文主要是介绍spring jdbctemplate配置多数据源,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
spring jdbctemplate配置多数据源
其实现在使用spring jdbctemplate与数据库交互已经有点low了,现在主流都是mybatis,但是遇到了就分享一下吧,spring jdbctemplate是怎么配置多数据源于调用的呢?
一、所搭建的项目为maven工程,pom.xml如下
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.ustcinfo</groupId><artifactId>faultsheetsync</artifactId><version>0.0.2-SNAPSHOT</version><name>springjdbc</name><description>spring jdbctemplate多数据源功能展示</description><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><slf4j.version>1.7.2</slf4j.version><logback.version>1.0.13</logback.version></properties><dependencies><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>4.1.5.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId><version>4.1.5.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>4.1.5.RELEASE</version></dependency><dependency><groupId>proxool</groupId><artifactId>proxool</artifactId><version>0.9.1</version></dependency><dependency><groupId>com.cloudhopper.proxool</groupId><artifactId>proxool-cglib</artifactId><version>0.9.1</version></dependency><dependency><groupId>com.oracle</groupId><artifactId>ojdbc6</artifactId><version>11.2.0.1.0</version></dependency><!--与日志相关的jar --><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>${slf4j.version}</version></dependency><dependency><groupId>ch.qos.logback</gro
这篇关于spring jdbctemplate配置多数据源的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!