一、spring命名空間
成都創(chuàng)新互聯(lián)是網(wǎng)站建設(shè)專家,致力于互聯(lián)網(wǎng)品牌建設(shè)與網(wǎng)絡(luò)營銷,專業(yè)領(lǐng)域包括網(wǎng)站制作、網(wǎng)站設(shè)計(jì)、電商網(wǎng)站制作開發(fā)、微信小程序定制開發(fā)、微信營銷、系統(tǒng)平臺開發(fā),與其他網(wǎng)站設(shè)計(jì)及系統(tǒng)開發(fā)公司不同,我們的整合解決方案結(jié)合了恒基網(wǎng)絡(luò)品牌建設(shè)經(jīng)驗(yàn)和互聯(lián)網(wǎng)整合營銷的理念,并將策略和執(zhí)行緊密結(jié)合,且不斷評估并優(yōu)化我們的方案,為客戶提供全方位的互聯(lián)網(wǎng)品牌整合方案!
Spring中所有的命名空間:
下載Spring源文件,解壓后會(huì)有個(gè)schema目錄,里面是所有Spring模塊。如下圖:
二、事物配置詳解
1、全注解xml文件配置
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
<bean id="dataSourceMaster" class="com.alibaba.druid.pool.DruidDataSource"
init-method="init" destroy-method="close">
<property name="driverClassName" value="${master.jdbc.driverClass}"/>
<property name="url" value="${master.jdbc.url}"/>
<property name="username" value="${master.jdbc.user}"/>
<property name="password" value="${master.jdbc.password}"/>
<property name="filters" value="stat"/>
<property name="maxActive" value="200"/>
<property name="initialSize" value="0"/>
<property name="maxWait" value="60000"/>
<property name="minIdle" value="0"/>
<property name="timeBetweenEvictionRunsMillis" value="60000"/>
<property name="minEvictableIdleTimeMillis" value="300000"/>
<property name="validationQuery" value="SELECT 'x'"/>
<property name="testWhileIdle" value="true"/>
<property name="testOnBorrow" value="false"/>
<property name="testOnReturn" value="false"/>
</bean>
<bean id="masterSqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSourceMaster"/>
<property name="configLocation"
value="classpath:/mybatis/mybatis_config.xml"/>
<property name="mapperLocations" value="classpath:mybatis/*Mapper.xml"/>
</bean>
<!-- mybatis mappers, scanned automatically -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.dao.mapper"/>
<property name="sqlSessionFactoryBeanName" value="masterSqlSessionFactory"/>
</bean>
<bean id="sqlSessionMaster" class="org.mybatis.spring.SqlSessionTemplate" scope="prototype">
<constructor-arg index="0" ref="masterSqlSessionFactory"/>
</bean>
<!-- spring開啟事務(wù)控制的注解支持 -->
<!-- MyBatis自動(dòng)參與到spring事務(wù)管理中,無需額外配置,
只要org.mybatis.spring.SqlSessionFactoryBean引用的數(shù)據(jù)源
與DataSourceTransactionManager引用的數(shù)據(jù)源一致即可,否則事務(wù)管理會(huì)不起作用。-->
<tx:annotation-driven transaction-manager="transactionManagerMaster" />
<bean id="transactionManagerMaster"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSourceMaster"/>
</bean>
</beans>
文章名稱:spring知識點(diǎn)詳解
新聞來源:http://www.yijiale78.com/article34/pcpjpe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、域名注冊、ChatGPT、云服務(wù)器、電子商務(wù)、移動(dòng)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)