123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <?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"
- xmlns:mvc="http://www.springframework.org/schema/mvc"
- 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 http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
- <context:component-scan base-package="com.kmall.framework.dao,com.kmall.framework.service">
- <!--过滤定时任务service-->
- <context:exclude-filter type="regex" expression="com.kmall.framework.service.impl.ScheduleJobServiceImpl"/>
- </context:component-scan>
- <bean id="placeholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="locations">
- <list>
- <value>classpath:conf/db.properties</value>
- <value>classpath:conf/express-kdn.properties</value>
- <value>classpath:conf/redis.properties</value>
- <value>classpath:conf/cus.properties</value>
- <value>classpath:conf/servlet.properties</value>
- <value>classpath:conf/wx-mp.properties</value>
- <value>classpath:conf/wx-global.properties</value>
- <value>classpath:conf/pingan-pay.properties</value>
- <value>classpath:conf/oms-merch.properties</value>
- <value>classpath:conf/websocket.properties</value>
- <value>classpath:conf/print-ticket.properties</value>
- <value>classpath:conf/common.properties</value>
- <value>classpath:conf/fastdfs.properties</value>
- </list>
- </property>
- <property name="fileEncoding" value="UTF-8"/>
- </bean>
- <context:annotation-config/>
- <mvc:default-servlet-handler/>
- <aop:aspectj-autoproxy proxy-target-class="true"/>
- <mvc:annotation-driven>
- <mvc:message-converters register-defaults="true">
- <bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
- <property name="supportedMediaTypes">
- <list>
- <value>text/html;charset=UTF-8</value>
- <value>application/json;charset=UTF-8</value>
- </list>
- </property>
- <property name="features">
- <list>
- <value>WriteMapNullValue</value>
- <value>QuoteFieldNames</value>
- <value>WriteDateUseDateFormat</value>
- <!-- 禁用fastjson循环引用检测 -->
- <value>DisableCircularReferenceDetect</value>
- </list>
- </property>
- </bean>
- </mvc:message-converters>
- </mvc:annotation-driven>
- <tx:annotation-driven/>
- <!--<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource">
- <property name="driverClassName" value="${jdbc.driver}"/>
- <property name="jdbcUrl" value="${jdbc.url}"/>
- <property name="username" value="${jdbc.username}"/>
- <property name="password" value="${jdbc.password}"/>
- <!– 队列中的最大等待数 –>
- <property name="idleTimeout" value="${jdbc.idleTimeout}"/>
- <!– the maximum lifetime of a connection in the pool –>
- <!– We strongly recommend setting this value,
- and it should be at least 30 seconds less than any database-level connection timeout. –>
- <property name="maxLifetime" value="${jdbc.maxLifetime}"/>
- <!– 最长等待时间,单位毫秒 –>
- <property name="connectionTimeout" value="${jdbc.connectionTimeout}"/>
- <!– 最大连接数 –>
- <property name="maximumPoolSize" value="${jdbc.maximumPoolSize}"/>
- <!– controls the maximum amount of time that a connection will be tested for aliveness.
- This value must be less than the connectionTimeout –>
- <property name="validationTimeout" value="${jdbc.validationTimeout}"/>
- <!– CAREFUL! THIS CONFIG IMPACTS SQL PERFORMANCE A LOT! –>
- <!–<property name="transactionIsolation" value="TRANSACTION_REPEATABLE_READ"/>–>
- </bean>-->
- <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>
- <property name="connectionInitSqls" value="set names utf8mb4;"/>
- <!--<!– 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 –>-->
- <property name="timeBetweenEvictionRunsMillis" value="60000" />
- <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
- <property name="minEvictableIdleTimeMillis" value="300000" />
- <!-- 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效 -->
- <property name="testWhileIdle" value="true" />
- <!-- 指定每个连接上PSCache的大小 -->
- <property name="maxPoolPreparedStatementPerConnectionSize" value="20" />
- </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.kmall.framework.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="dataSource"></property>
- </bean>
- <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
- <property name="dataSource">
- <ref bean="dataSource"/>
- </property>
- </bean>
- <!-- JDBC配置 -->
- <bean id="namedParameterJdbcTemplate"
- class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
- <constructor-arg ref="dataSource"/>
- </bean>
- <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
- <property name="configLocation" value="classpath:mybatis.xml"/>
- <property name="mapperLocations" value="classpath:mybatis/mapper/**/*.xml"/>
- <property name="dataSource" ref="dataSource"/>
- </bean>
- <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
- <property name="basePackage" value="com.kmall.framework.dao"/>
- </bean>
- <bean id="restTemplate" class="org.springframework.web.client.RestTemplate"/>
- </beans>
|