You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
3.0 KiB
56 lines
3.0 KiB
11 months ago
|
<?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:p="http://www.springframework.org/schema/p"
|
||
|
xmlns:c="http://www.springframework.org/schema/c"
|
||
|
xmlns:util="http://www.springframework.org/schema/util"
|
||
|
xmlns:context="http://www.springframework.org/schema/context"
|
||
|
xmlns:aop="http://www.springframework.org/schema/aop"
|
||
|
xmlns:tx="http://www.springframework.org/schema/tx"
|
||
|
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||
|
xsi:schemaLocation="
|
||
|
http://www.springframework.org/schema/beans
|
||
|
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||
|
http://www.springframework.org/schema/util
|
||
|
http://www.springframework.org/schema/util/spring-util.xsd
|
||
|
http://www.springframework.org/schema/context
|
||
|
http://www.springframework.org/schema/context/spring-context.xsd
|
||
|
http://www.springframework.org/schema/aop
|
||
|
http://www.springframework.org/schema/aop/spring-aop.xsd
|
||
|
http://www.springframework.org/schema/tx
|
||
|
http://www.springframework.org/schema/tx/spring-tx.xsd
|
||
|
http://www.springframework.org/schema/mvc
|
||
|
http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||
|
">
|
||
|
<!--加载外部属性文件-->
|
||
|
<context:property-placeholder location="classpath:jdbc.properties"></context:property-placeholder>
|
||
|
<!--扫描service层-->
|
||
|
<context:component-scan base-package="com.zhangzeyuan.service"></context:component-scan>
|
||
|
<!--配置德鲁伊数据源-->
|
||
|
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
|
||
|
<property name="username" value="${jdbc_username}"></property>
|
||
|
<property name="password" value="${jdbc_password}"></property>
|
||
|
<property name="url" value="${jdbc_url}"></property>
|
||
|
<property name="driverClassName" value="${jdbc_driver}"></property>
|
||
|
</bean>
|
||
|
<!--配置sqlSessionFactory-->
|
||
|
<bean id="factory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
||
|
<!-- 配置数据源 -->
|
||
|
<property name="dataSource" ref="dataSource"></property>
|
||
|
<!-- 实体类别名包扫描-->
|
||
|
<property name="typeAliasesPackage" value="com.zhangzeyuan.pojo"></property>
|
||
|
</bean>
|
||
|
<!--配置MapperScanner 扫描mapper.xml 和接口-->
|
||
|
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
||
|
<!--配置SQLSessionFactory-->
|
||
|
<property name="sqlSessionFactoryBeanName" value="factory"></property>
|
||
|
<!--扫描mapper-->
|
||
|
<property name="basePackage" value="com.zhangzeyuan.mapper"></property>
|
||
|
</bean>
|
||
|
<!--配置事务管理器-->
|
||
|
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||
|
<property name="dataSource" ref="dataSource"></property>
|
||
|
</bean>
|
||
|
<!--开启事务注解-->
|
||
|
<tx:annotation-driven transaction-manager="transactionManager"/>
|
||
|
</beans>
|