ssm integrated spring.xml configuration file (applicationContext.xml)

<?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:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
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/context http://www.springframework.org/schema/context/spring-context.xsd">

<context:component-scan base-package="com.aaa.ssm.service"></context:component-scan>
<!--创建dbcp数据源连接池对象-->
<bean name="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property>
<property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl"></property>
<property name="username" value="scott"></property>
<property name="password" value="tiger"></property>
</bean><!--创建mybatis的SqlSessionFactory工厂类对象--><bean class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource"></ Property> <Property<-! mapper file address specified here can use the asterisk the same configuration will load all at the end of the package mapper xml file ->




name = "mapperLocations" value =. "the CLASSPATH: COM / aaa / the SSM / dao / * xml" > </ Property>
</ bean> ! <- configure scan mybatis of dao interface, the interface creates myabtis as the dao dao interface class object placed in the session factory -> <the bean class = "org.mybatis.spring.mapper.MapperScannerConfigurer" > <-! dao interface which specifies packet -> <Property name = "basePackage" value = "com.aaa.ssm.dao" > </ Property> </ bean> <-! declaration spring things Manager object -> <bean the above mentioned id = "transactionManager" class = "org.springframework.jdbc. datasource.DataSourceTransactionManager "> <property name="dataSource" ref








= "dataSource" > </ Property>
</ bean> <- things statement annotation disposed of spring ->! < tx : Annotation-Driven Transaction-Manager = "transactionManager" > </ tx : Annotation-Driven > </ Beans>


Guess you like

Origin www.cnblogs.com/b6952/p/10939504.html
Recommended