提交多数据源示例
This commit is contained in:
parent
f66717261f
commit
8538637248
|
|
@ -7,14 +7,6 @@ master.url = jdbc:mysql://localhost:3306/blade?useUnicode=true&characterEncoding
|
|||
master.username = root
|
||||
master.password = root
|
||||
|
||||
#oracle数据源配置
|
||||
#master.dbType = oracle
|
||||
#master.driver = oracle.jdbc.driver.OracleDriver
|
||||
#master.url = jdbc:oracle:thin:@127.0.0.1:1521:orcl
|
||||
#master.username = blade
|
||||
#master.password = blade
|
||||
|
||||
|
||||
#多数据源数据库配置
|
||||
#other.dbType = mysql
|
||||
#other.driver = com.mysql.jdbc.Driver
|
||||
|
|
@ -22,6 +14,13 @@ master.password = root
|
|||
#other.username = root
|
||||
#other.password = qazwsx
|
||||
|
||||
#oracle数据源配置
|
||||
#master.dbType = oracle
|
||||
#master.driver = oracle.jdbc.driver.OracleDriver
|
||||
#master.url = jdbc:oracle:thin:@127.0.0.1:1521:orcl
|
||||
#master.username = blade
|
||||
#master.password = blade
|
||||
|
||||
# 初始连接池大小、最小空闲连接数、最大活跃连接数
|
||||
druid.initialSize = 5
|
||||
druid.maxActive = 100
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.smallchill.platform.model;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import com.smallchill.core.annotation.DbName;
|
||||
import org.beetl.sql.core.annotatoin.AutoID;
|
||||
import org.beetl.sql.core.annotatoin.SeqID;
|
||||
import org.beetl.sql.core.annotatoin.Table;
|
||||
|
|
@ -11,6 +12,7 @@ import com.smallchill.core.base.model.BaseModel;
|
|||
|
||||
@Table(name = "tb_yw_tzgg")
|
||||
@BindID(name = "f_it_xl")
|
||||
//@DbName(name = "other") //多数据源配置注解
|
||||
@SuppressWarnings("serial")
|
||||
public class Notice extends BaseModel {
|
||||
private String f_it_xl;
|
||||
|
|
@ -23,8 +25,8 @@ public class Notice extends BaseModel {
|
|||
private Date f_dt_fbsj;
|
||||
private Integer version;
|
||||
|
||||
@AutoID
|
||||
@SeqID(name = "SEQ_NOTICE")
|
||||
@AutoID //mysql自增使用
|
||||
@SeqID(name = "SEQ_NOTICE") //oracle sequence序列使用
|
||||
public String getF_it_xl() {
|
||||
return f_it_xl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@
|
|||
<property name="filters" value="mergeStat" />
|
||||
</bean>
|
||||
|
||||
<!-- 主数据源 -->
|
||||
<bean id="dataSource" parent="baseDataSource" init-method="init">
|
||||
<property name="driverClassName" value="${master.driver}" />
|
||||
<property name="url" value="${master.url}" />
|
||||
|
|
@ -64,6 +65,14 @@
|
|||
<property name="password" value="${master.password}" />
|
||||
</bean>
|
||||
|
||||
<!-- 多数据源 -->
|
||||
<!--<bean id="otherSource" parent="baseDataSource" init-method="init">
|
||||
<property name="driverClassName" value="${other.driver}" />
|
||||
<property name="url" value="${other.url}" />
|
||||
<property name="username" value="${other.username}" />
|
||||
<property name="password" value="${other.password}" />
|
||||
</bean>-->
|
||||
|
||||
|
||||
<!-- 配置 Annotation 驱动,扫描@Transactional注解的类定义事务 -->
|
||||
<!-- <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/> -->
|
||||
|
|
|
|||
|
|
@ -49,6 +49,36 @@
|
|||
<property name="configLocation" value="classpath:/config/beetlsql.properties"></property>
|
||||
</bean>
|
||||
|
||||
<!-- 注册sqlmanager(其他库) -->
|
||||
<!--<bean id="otherSqlManager" class="org.beetl.sql.ext.spring4.SqlManagerFactoryBean">
|
||||
<property name="nc">
|
||||
<bean class="org.beetl.sql.core.DefaultNameConversion"></bean>
|
||||
</property>
|
||||
<property name="interceptors">
|
||||
<list>
|
||||
<bean class="com.smallchill.core.beetl.ReportInterceptor"></bean>
|
||||
</list>
|
||||
</property>
|
||||
<property name="cs">
|
||||
<bean class="org.beetl.sql.ext.spring4.BeetlSqlDataSource">
|
||||
<property name="masterSource" ref="otherSource"></property>
|
||||
</bean>
|
||||
</property>
|
||||
<property name="dbStyle">
|
||||
<bean class="org.beetl.sql.core.db.MySqlStyle"></bean>
|
||||
</property>
|
||||
<property name="sqlLoader">
|
||||
<bean class="org.beetl.sql.core.ClasspathLoader">
|
||||
<property name="sqlRoot" value="/beetlsql"></property>
|
||||
<property name="charset" value="UTF-8"></property>
|
||||
<property name="dbs">
|
||||
<bean class="org.beetl.sql.core.db.MySqlStyle"></bean>
|
||||
</property>
|
||||
</bean>
|
||||
</property>
|
||||
<property name="configLocation" value="classpath:/config/beetlsql.properties"></property>
|
||||
</bean>-->
|
||||
|
||||
<!-- blade框架自定义config -->
|
||||
<bean id="bladeConfig" class="com.smallchill.core.config.BladeConfig">
|
||||
<!-- 注入自定义config -->
|
||||
|
|
@ -58,7 +88,8 @@
|
|||
<!-- 注入sqlManagerMap -->
|
||||
<property name="sqlManager">
|
||||
<map>
|
||||
<entry key="master" value-ref="sqlManager" />
|
||||
<entry key="master" value-ref="sqlManager" />
|
||||
<!--<entry key="other" value-ref="otherSqlManager" />-->
|
||||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user