日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

Spring3整合Ibatis3配置

發(fā)布時(shí)間:2023/12/31 javascript 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Spring3整合Ibatis3配置 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
步驟一:在web.xml中配置spring <context-param>????
????????<param-name>contextConfigLocation</param-name>????
????????<param-value>classpath*:spring/applicationContext*.xml</param-value>????
????</context-param>

????<!--Spring的ApplicationContext 載入 -->
<listener>
????<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener> ? 步驟二:配置applicationContext.xml ? <!--設(shè)置配置文件--> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">????????????
???????<property name="locations">????????????
??????????? <list>????????????
?????????????????<value>classpath*:/application.properties</value>
???????????????? <value>classpath*:/db.properties</value>??
</list>????????????
???????</property>????????????
</bean>???????? <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">????
????????<property name="maxActive" value="20" />????
????????<property name="maxIdle" value="20" />????
????????<property name="maxWait" value="3000" />????
????????<property name="testWhileIdle" value="true" />????
????????<property name="timeBetweenEvictionRunsMillis" value="3600000" />????
????????<property name="validationQuery" value="select 1" />????
????????<property name="removeAbandoned" value="true" />????
????????<property name="removeAbandonedTimeout" value="1" />????
  <property name="driverClassName" value="${jdbc.driverClassName}" />????
  <property name="url" value="${jdbc.url}" />????
  <property name="username" value="${jdbc.username}" />????
  <property name="password" value="${jdbc.password}" />????
????</bean>????
<bean id="sqlSessionFactory" class="org.springframework.orm.ibatis3.SqlSessionFactoryBean">
????<property name="configLocation" value="classpath:ibatis-config.xml" />
????<property name="dataSource" ref="dataSource" />
??</bean>
??<bean id="sqlSessionTemplate" class="org.springframework.orm.ibatis3.SqlSessionTemplate">
????<property name="sqlSessionFactory" ref="sqlSessionFactory" />
??</bean>
? <!--事務(wù)配置-->
??<tx:annotation-driven transaction-manager="transactionManager" />
??<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" autowire="byName" /> 注:db.properties內(nèi)容如下
jdbcNum=2
jdbc.driverClass=com.mysql.jdbc.Driver

jdbc.url=jdbc:mysql://192.168.1.1:3306/bookdb?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false
jdbc.username=sophie
jdbc.passworld=123456

轉(zhuǎn)載于:https://blog.51cto.com/mmqzlj/498975

總結(jié)

以上是生活随笔為你收集整理的Spring3整合Ibatis3配置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。