<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<!--開啟自動掃描富岳,將加注解的bean放入容器-->
<context:component-scan base-package="com.kaishengit">
<!--排除controller重復(fù)掃描-->
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<!--加載properties配置文件,選配-->
<context:property-placeholder location="classpath:config.properties"/>
<!--配置數(shù)據(jù)源-->
<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driver}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
<!--事務(wù)管理器-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!--開啟基于注解的事務(wù)管理-->
<tx:annotation-driven transaction-manager="transactionManager"/>
<!--mybatis SqlSessionFactory-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!--數(shù)據(jù)源-->
<property name="dataSource" ref="dataSource"/>
<!--別名的包所在的位置-->
<property name="typeAliasesPackage" value="com.kaishengit.entity"/>
<!--mapper文件所在的位置-->
<property name="mapperLocations" value="classpath:mapper/*.xml"/>
<!--分頁插件配置-->
<property name="plugins">
<array>
<bean class="com.github.pagehelper.PageInterceptor">
<property name="properties">
<value>helperDialect=mysql</value>
</property>
</bean>
</array>
</property>
<!--其他配置-->
<property name="configuration">
<bean class="org.apache.ibatis.session.Configuration">
<property name="mapUnderscoreToCamelCase" value="true"/>
</bean>
</property>
</bean>
<!--掃描mybatis中的Mapper接口,并自動放入spring容器-->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.kaishengit.mapper"/>
</bean>
</beans>
SSM整合的applicationContext.xml配置文件
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
- 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來柬唯,“玉大人认臊,你說我怎么就攤上這事∪ǘ海” “怎么了美尸?”我有些...
- 文/不壞的土叔 我叫張陵,是天一觀的道長斟薇。 經(jīng)常有香客問我师坎,道長,這世上最難降的妖魔是什么堪滨? 我笑而不...
- 正文 為了忘掉前任胯陋,我火速辦了婚禮,結(jié)果婚禮上袱箱,老公的妹妹穿的比我還像新娘遏乔。我一直安慰自己,他們只是感情好发笔,可當我...
- 文/花漫 我一把揭開白布盟萨。 她就那樣靜靜地躺著,像睡著了一般了讨。 火紅的嫁衣襯著肌膚如雪捻激。 梳的紋絲不亂的頭發(fā)上,一...
- 文/蒼蘭香墨 我猛地睜開眼吊趾,長吁一口氣:“原來是場噩夢啊……” “哼形帮!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起袖牙,我...
- 正文 年R本政府宣布,位于F島的核電站右犹,受9級特大地震影響提澎,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜念链,卻給世界環(huán)境...
- 文/蒙蒙 一盼忌、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧掂墓,春花似錦谦纱、人聲如沸。這莊子的主人今日做“春日...
- 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至吃嘿,卻和暖如春偿荷,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背唠椭。 一陣腳步聲響...
推薦閱讀更多精彩內(nèi)容
- 出現(xiàn)以下的情況(org.apache.ibatis.binding.BindingException: Inval...