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.
86 lines
3.1 KiB
86 lines
3.1 KiB
<?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" xmlns:aop="http://www.springframework.org/schema/aop"
|
|
xsi:schemaLocation="
|
|
http://www.springframework.org/schema/beans
|
|
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
|
|
http://www.springframework.org/schema/context
|
|
http://www.springframework.org/schema/context/spring-context-4.2.xsd
|
|
http://www.springframework.org/schema/tx
|
|
http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
|
|
http://www.springframework.org/schema/aop
|
|
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
|
|
|
|
<tx:annotation-driven />
|
|
<context:property-placeholder location="classpath:db.properties" />
|
|
|
|
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
|
|
init-method="init" destroy-method="close">
|
|
<property name="url">
|
|
<value>${jdbc.url}</value>
|
|
</property>
|
|
<property name="username">
|
|
<value>${jdbc.username}</value>
|
|
</property>
|
|
<property name="password">
|
|
<value>${jdbc.password}</value>
|
|
</property>
|
|
<property name="initialSize">
|
|
<value>${jdbc.initialSize}</value>
|
|
</property>
|
|
<property name="maxActive">
|
|
<value>${jdbc.maxActive}</value>
|
|
</property>
|
|
<property name="proxyFilters">
|
|
<list>
|
|
<ref bean="stat-filter" />
|
|
<ref bean="wall-filter" />
|
|
</list>
|
|
</property>
|
|
</bean>
|
|
|
|
<bean id="stat-filter" class="com.alibaba.druid.filter.stat.StatFilter">
|
|
<property name="slowSqlMillis" value="1000" />
|
|
<property name="logSlowSql" value="true" />
|
|
<property name="mergeSql" value="true" />
|
|
</bean>
|
|
|
|
<bean id="wall-filter" class="com.alibaba.druid.wall.WallFilter">
|
|
<property name="dbType" value="mysql" />
|
|
<property name="config" ref="wall-filter-config" />
|
|
</bean>
|
|
|
|
<bean id="wall-filter-config" class="com.alibaba.druid.wall.WallConfig">
|
|
<property name="multiStatementAllow" value="true" />
|
|
</bean>
|
|
|
|
<bean id="druid-stat-interceptor" class="com.alibaba.druid.support.spring.stat.DruidStatInterceptor"></bean>
|
|
<bean id="druid-stat-pointcut" class="org.springframework.aop.support.JdkRegexpMethodPointcut" scope="prototype">
|
|
<property name="patterns">
|
|
<list>
|
|
<value>com.learn.controller.*</value>
|
|
<value>com.learn.service.*</value>
|
|
</list>
|
|
</property>
|
|
</bean>
|
|
<aop:config>
|
|
<aop:advisor advice-ref="druid-stat-interceptor" pointcut-ref="druid-stat-pointcut"/>
|
|
</aop:config>
|
|
|
|
<bean id="transactionManager"
|
|
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
|
<property name="dataSource">
|
|
<ref bean="dataSource" />
|
|
</property>
|
|
</bean>
|
|
|
|
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
|
<property name="configLocation" value="classpath:mybatis.xml" />
|
|
<property name="dataSource" ref="dataSource" />
|
|
</bean>
|
|
|
|
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
|
<property name="basePackage" value="com.learn.dao" />
|
|
</bean>
|
|
</beans> |