BeeCP-Starter 1.3.1 发布,Spring Boot 上的启动器

栏目: 软件资讯 · 发布时间: 5年前

内容简介:BeeCP-Starter是小蜜蜂连接池在Springboot上的启动器 相关功能 1:文件方式配置数据源信息 2:支持多数据源配置 3:可通过自定义的方式支持其他数据源 4:支持配置Jndi数据源引入配置 运行依赖 1:Java版本:JDK...

BeeCP-Starter是小蜜蜂连接池在Springboot上的启动器

相关功能

1:文件方式配置数据源信息

2:支持多数据源配置

3:可通过自定义的方式支持其他数据源

4:支持配置Jndi数据源引入配置

运行依赖

1:Java版本:JDK1.8

2:Springboot版本:2.0.9.RELEASE

3:BeeCP版本:2.4.7

版本下载

<dependency>
	<groupId>com.github.chris2018998</groupId>
	<artifactId>spring-boot-starter-beecp</artifactId>
	<version>1.3.1.RELEASE</version>
</dependency>

 

单数据源范例

application.properties

   #单数据源配置点(ioc注册名:beeDataSource)
   spring.datasource.type=cn.beecp.BeeDataSource
   spring.datasource.poolName=BeeCP1
   spring.datasource.username=root
   spring.datasource.password=
   spring.datasource.jdbcUrl=jdbc:mysql://localhost:3306/test
   spring.datasource.driverClassName=com.mysql.jdbc.Driver

IOC 

多数据源范例

application.properties

#多数据源配置起点(ioc注册名分别是d1,d2,d3)
spring.datasource.nameList=d1,d2,d3 

#第1数据源
spring.datasource.d1.primary=true  
spring.datasource.d1.poolName=BeeCP1
spring.datasource.d1.username=root
spring.datasource.d1.password=root
spring.datasource.d1.jdbcUrl=jdbc:mysql://localhost:3306/test
spring.datasource.d1.driverClassName=com.mysql.cj.jdbc.Driver
 
#第2数据源
spring.datasource.d2.jndiName=testDB 
  

#第3数据源
spring.datasource.d3.poolName=testDB
spring.datasource.d3.datasourceType=com.xxx.xxxDataSource
spring.datasource.d3.datasourceAttributeSetFactory=xxxx
spring.datasource.d3.username=root
spring.datasource.d3.password=root
spring.datasource.d3.jdbcUrl=jdbc:mysql://localhost:3306/test
spring.datasource.d3.driverClassName=com.mysql.cj.jdbc.Driver

#xxxx为对应连接池的属性注入工厂类的实现,请参照*扩展接口*

DemoApplication.java

//引入多数据源标签
@EnableMultiDataSource
@SpringBootApplication
public class DemoApplication {
  public static void main(String[] args) {
     SpringApplication.run(DemoApplication.class, args);
   }
}

扩展接口

 public interface DataSourceAttributeSetFactory {

   //get Properties value from environment and set to dataSource
   public void set(DataSource ds,String configPrefix,Environment environment)throws Exception;
}

以上所述就是小编给大家介绍的《BeeCP-Starter 1.3.1 发布,Spring Boot 上的启动器》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

计算机程序设计艺术:第4卷 第4册(双语版)

计算机程序设计艺术:第4卷 第4册(双语版)

Donald E.Knuth / 苏运霖 / 机械工业出版社 / 2007-4 / 42.00元

关于算法分析的这多卷论著已经长期被公认为经典计算机科学的定义性描述。迄今已出版的完整的三卷组成了程序设计理论和实践的惟一的珍贵源泉,无数读者都赞扬Knuth的著作对个人的深远影响。科学家们为他的分析的美丽和优雅所惊叹,而从事实践的程序员们已经成功地应用他的“菜谱式”的解到日常问题上,所有人都由于Knuth在书中所表现出的博学、清晰、精确和高度幽默而对他无比敬仰。   为开始后续各卷的写作并更......一起来看看 《计算机程序设计艺术:第4卷 第4册(双语版)》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具