<!--扫描service的impl-->
<context:component-scan base-package="com.aaa.ssm.service.impl"></context:component-scan>
<!--加载jdbc.properties-->
<context:property-placeholder location="classpath:jdbc.properties"></context:property-placeholder>
<!--创建dbcp数据源连接池-->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${driver}"></property>
<property name="url" value="${url}"></property>
<property name="username" value="${user}"></property>
<property name="password" value="${password}"> </ Property> <-! specified data source -><the bean class = "org.mybatis.spring.SqlSessionFactoryBean"><-! create an object factory classes mybatis ->
</ the bean>
<Property name = "the dataSource" REF = "the dataSource"> </ Property>
<-! loading mybatis mapping file (mapper.xml) may be used in the value wildcard * ->
<Property name = "the mapperLocations" value = "CLASSPATH:. COM / AAA / SSM / dao / XML *"> </ Property>
</ the bean>
! <- generates a class object interface in dao spring plant ->
<the bean class = "ORG. mybatis.spring.mapper.MapperScannerConfigurer ">
<-! Specifies that package to scan all of the following interfaces dao ->
<Property name =" basePackage "value =" com.aaa.ssm.dao "> </ Property>
< / bean>
<-! Creating spring transaction Manager ->
<bean the above mentioned id = "transactionManager" class = "org.springframework.jdbc.datasource.DataSourceTransactionManager">
<name = Property "dataSource" ref = "dataSource"> </ Property>
</ bean>
<-! statement notes declarative way to configure things ->
<tx:annotation-driven transaction-manager="transactionManager"></tx:annotation-driven>
SSM in spring.xml profile
Guess you like
Origin www.cnblogs.com/LFY001023/p/10966755.html
Recommended
Ranking