欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

使用SpringMVC如何實(shí)現(xiàn)將java項(xiàng)目連接兩個(gè)數(shù)據(jù)庫(kù)-創(chuàng)新互聯(lián)

使用Spring MVC如何實(shí)現(xiàn)將java項(xiàng)目連接兩個(gè)數(shù)據(jù)庫(kù)?針對(duì)這個(gè)問(wèn)題,這篇文章詳細(xì)介紹了相對(duì)應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問(wèn)題的小伙伴找到更簡(jiǎn)單易行的方法。

武強(qiáng)ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書(shū)未來(lái)市場(chǎng)廣闊!成為創(chuàng)新互聯(lián)建站的ssl證書(shū)銷(xiāo)售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話(huà)聯(lián)系或者加微信:13518219792(備注:SSL證書(shū)合作)期待與您的合作!

實(shí)現(xiàn)方法:

數(shù)據(jù)源在配置文件中的配置

<pre name="code" class="java"><&#63;xml version="1.0" encoding="UTF-8"&#63;> 
<beans xmlns="http://www.springframework.org/schema/beans" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" 
 xmlns:cache="http://www.springframework.org/schema/cache" 
 xmlns:context="http://www.springframework.org/schema/context" 
 xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee" 
 xmlns:jms="http://www.springframework.org/schema/jms" xmlns:lang="http://www.springframework.org/schema/lang" 
 xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:oxm="http://www.springframework.org/schema/oxm" 
 xmlns:p="http://www.springframework.org/schema/p" xmlns:task="http://www.springframework.org/schema/task" 
 xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" 
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
 http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd 
 http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd 
 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd 
 http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd 
 http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd 
 http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-3.1.xsd 
 http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.1.xsd 
 http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd 
 http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.1.xsd 
 http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd 
 http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd 
 http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd"> 
 
 <context:annotation-config /> 
 
 <context:component-scan base-package="com"></context:component-scan> 
 
 <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
  <property name="locations"> 
   <list> 
    <value>classpath:com/resource/config.properties</value> 
   </list> 
  </property> 
 </bean> 
 
 <bean id="dataSourceOne" class="com.mchange.v2.c3p0.ComboPooledDataSource" 
  destroy-method="close"> 
  <property name="driverClass" value="${dbOne.jdbc.driverClass}" /> 
  <property name="jdbcUrl" value="${dbOne.jdbc.url}" /> 
  <property name="user" value="${dbOne.jdbc.user}" /> 
  <property name="password" value="${dbOne.jdbc.password}" /> 
  <property name="initialPoolSize" value="${dbOne.jdbc.initialPoolSize}" /> 
  <property name="minPoolSize" value="${dbOne.jdbc.minPoolSize}" /> 
  <property name="maxPoolSize" value="${dbOne.jdbc.maxPoolSize}" /> 
 </bean> 
 
 <bean id="dataSourceTwo" class="com.mchange.v2.c3p0.ComboPooledDataSource" 
  destroy-method="close"> 
  <property name="driverClass" value="${dbTwo.jdbc.driverClass}" /> 
  <property name="jdbcUrl" value="${dbTwo.jdbc.url}" /> 
  <property name="user" value="${dbTwo.jdbc.user}" /> 
  <property name="password" value="${dbTwo.jdbc.password}" /> 
  <property name="initialPoolSize" value="${dbTwo.jdbc.initialPoolSize}" /> 
  <property name="minPoolSize" value="${dbTwo.jdbc.minPoolSize}" /> 
  <property name="maxPoolSize" value="${dbTwo.jdbc.maxPoolSize}" /> 
 </bean> 
 
 <bean id="dynamicDataSource" class="com.core.DynamicDataSource"> 
  <property name="targetDataSources"> 
   <map key-type="java.lang.String"> 
    <entry value-ref="dataSourceOne" key="dataSourceOne"></entry> 
    <entry value-ref="dataSourceTwo" key="dataSourceTwo"></entry> 
   </map> 
  </property> 
  <property name="defaultTargetDataSource" ref="dataSourceOne"> 
  </property> 
 </bean> 
 
 <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> 
  <property name="dataSource" ref="dynamicDataSource" /> 
  <property name="hibernateProperties"> 
   <props> 
    <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> 
    <prop key="hibernate.current_session_context_class">org.springframework.orm.hibernate4.SpringSessionContext</prop> 
    <prop key="hibernate.show_sql">false</prop> 
    <prop key="hibernate.format_sql">true</prop> 
    <prop key="hbm2ddl.auto">create</prop> 
   </props> 
  </property> 
  <property name="packagesToScan"> 
   <list> 
    <value>com.po</value> 
   </list> 
  </property> 
 </bean> 
 
 <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> 
  <property name="sessionFactory" ref="sessionFactory" /> 
 </bean> 
 
 <aop:config> 
  <aop:pointcut id="transactionPointCut" expression="execution(* com.dao..*.*(..))" /> 
  <aop:advisor advice-ref="txAdvice" pointcut-ref="transactionPointCut" /> 
 </aop:config> 
 
 <tx:advice id="txAdvice" transaction-manager="transactionManager"> 
  <tx:attributes> 
   <tx:method name="add*" propagation="REQUIRED" /> 
   <tx:method name="save*" propagation="REQUIRED" /> 
   <tx:method name="update*" propagation="REQUIRED" /> 
   <tx:method name="delete*" propagation="REQUIRED" /> 
   <tx:method name="*" read-only="true" /> 
  </tx:attributes> 
 </tx:advice> 
 
 <aop:config> 
  <aop:aspect id="dataSourceAspect" ref="dataSourceInterceptor"> 
   <aop:pointcut id="daoOne" expression="execution(* com.dao.one.*.*(..))" /> 
   <aop:pointcut id="daoTwo" expression="execution(* com.dao.two.*.*(..))" /> 
   <aop:before pointcut-ref="daoOne" method="setdataSourceOne" /> 
   <aop:before pointcut-ref="daoTwo" method="setdataSourceTwo" /> 
  </aop:aspect> 
 </aop:config> 
</beans> 

網(wǎng)頁(yè)標(biāo)題:使用SpringMVC如何實(shí)現(xiàn)將java項(xiàng)目連接兩個(gè)數(shù)據(jù)庫(kù)-創(chuàng)新互聯(lián)
標(biāo)題鏈接:http://aaarwkj.com/article28/dohpjp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)網(wǎng)站制作、網(wǎng)站內(nèi)鏈建站公司、電子商務(wù)網(wǎng)站維護(hù)、Google

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

營(yíng)銷(xiāo)型網(wǎng)站建設(shè)
伊人色综合久久天天五月婷| 久久精品视频亚洲一级| 国产91九色蝌蚪在线观看| 精品国产91高清在线观看| 成人综合影视中文字幕| 精品国产欧美成人一区| 激情亚洲不卡一区二区| av大全网站免费一区二区| 青青草免费公开视频久久| 中文字幕加勒比东京热| 日韩欧美国产精品一区二区三区 | 久久日韩人妻中文字幕| 亚洲婷婷久久一区二区| 97视频在线中文字幕| 91九色在线精品一区| av男人的天堂一区二区| 亚洲一区二区三区四区五区六| 大屁股白浆一区二区三区| 91九色国产在线视频| 国产精品一区二区三区 在线| 亚洲精品av一区二区久久| 国产成人在线免费短视频| 国产成十人十综合十亚洲| 日韩精品视频高清在线观看| 欧美三级亚洲三级日韩三级| 亚洲精品午夜在线观看| av资源在线观看少妇丰满| 国产精品乱码精品久久久| 欧美精品一区二区毛卡片| 亚洲欧美日韩不卡视频| 日本高清不卡在线播放| 不卡一区二区福利日本| 中日韩中文字幕一区二区| 欧美偷拍一区二区三区| 久久五十路六十路熟妇中出| 欧美三级伦理片免费观看| 91欧美精品一区二区| 亚洲国产精品久久久精品| 国产日韩亚洲欧美精品专区| 偷拍视频一区二区三区| 欧美精品高清在线视频|