applicationContext.xml 5.06 KB
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:task="http://www.springframework.org/schema/task" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">

<context:component-scan base-package="com.lymsh.yimiao.main.data.dao" />
<context:component-scan base-package="com.lymsh.yimiao.main.data.service" />
<context:component-scan base-package="com.lymsh.yimiao.main.data.util" />
<context:component-scan base-package="com.lymsh.yimiao.main.data.service.impl" />

<bean id="configProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>classpath:config.properties</value>
</list>
</property>
</bean>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer">
<property name="properties" ref="configProperties" />
</bean>


<aop:aspectj-autoproxy/>

<!-- All class in the back-package are auto loaded as a service -->
<context:component-scan base-package="com.lymsh.mommybaby" >
<context:include-filter type="regex" expression=".main.data..service.impl.*"/>
</context:component-scan>

<!-- DataSource configuration 项目主数据库 -->
<bean name="mainDataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<property name="url" value="${maindata.jdbcurl}" />
<property name="username" value="${maindata.username}" />
<property name="password" value="${maindata.password}" />
<property name="initialSize" value="10" />
<property name="maxActive" value="100" />
<property name="maxIdle" value="10" />
<property name="minIdle" value="0" />
<property name="maxWait" value="10000" />
<!-- <property name="validationQuery" value="${validationQuery3}" /> -->
<property name="testOnBorrow" value="false" />
<property name="testOnReturn" value="false" />
<property name="testWhileIdle" value="true" />
<property name="timeBetweenEvictionRunsMillis" value="60000" />
<property name="minEvictableIdleTimeMillis" value="25200000" />
<property name="removeAbandoned" value="true" />
<property name="removeAbandonedTimeout" value="1800" />
<property name="logAbandoned" value="true" />
<property name="filters" value="stat" />
</bean>

<bean id="mainJdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"
p:dataSource-ref="mainDataSource" />

<bean id="mainSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="mainDataSource" />
<property name="mapperLocations">
<list>
<value>classpath*:mainOrm/*.xml</value>
</list>
</property>
</bean>

<!-- manage transaction -->
<bean id="mainTransactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="mainDataSource" />
</bean>


<tx:annotation-driven transaction-manager="mainTransactionManager"/>

<!-- Mabatis Data Layer -->
<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="mainSqlSessionFactory" />
</bean>

<!-- all class in the back-package are auto loaded as a mapper -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="sqlSessionFactoryBeanName" value="mainSqlSessionFactory"></property>
<property name="basePackage" value="com.lymsh.yimiao.main.data.dao" />
</bean>


<!--JPush Client-->
<bean class="cn.jpush.api.JPushClient">
<constructor-arg name="appKey" value="${jpush.AppKey}"/>
<constructor-arg name="masterSecret" value="${jpush.MasterSecret}"/>
<constructor-arg name="apnsProduction" value="${jpush.apnsProduction}"/>
<constructor-arg name="timeToLive" value="${jpush.timeToLive}"/>
</bean>

<!-- 定时发送接种消息 -->
<task:scheduled-tasks>
<task:scheduled ref="pushTaskService" method="pushTask" cron="0 0 10 * * ?"/>
</task:scheduled-tasks>



</beans>