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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?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/aop http://www.springframework.org/schema/aop/spring-aop-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/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
<context:property-placeholder location="classpath:config.properties"/>
<bean id="coreApplicationListener" class="com.hand.hap.core.ApplicationListenerBean"/>
<bean id="hikariConfig" class="com.zaxxer.hikari.HikariConfig">
<property name="poolName" value="springHikariCP" />
<property name="connectionTestQuery" value="SELECT 1 from dual" />
<property name="driverClassName" value="${db.driverClassName}" />
<property name="jdbcUrl" value="${db.url}" />
<property name="username" value="${db.username}" />
<property name="password" value="${db.password}" />
<property name="maxLifetime" value="${db.maxLifetime:600000}"/>
<property name="maximumPoolSize" value="${db.maxPoolSize:200}"/>
<property name="minimumIdle" value="${db.minIdle:30}"/>
<property name="connectionTimeout" value="${db.connectionTimeout:90000}"></property>
<!--<property name="dataSourceClassName" value="${db.driverClassName}" />-->
<property name="dataSourceProperties">
<props>
</props>
</property>
</bean>
<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
<constructor-arg ref="hikariConfig" />
</bean>
<!-- middleware datasource com.hand.hap.core.JndiObjectFactoryBean-->
<!-- jndi dataSource-->
<!--<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="${db.jndiName}"/>
</bean>-->
<!--<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${db.driverClassName}"/>
<property name="url" value="${db.url}"/>
<property name="username" value="${db.username}"/>
<property name="password" value="${db.password}"/>
</bean>-->
<bean id="languageProvider" class="com.hand.hap.core.impl.LanguageProviderImpl"/>
<bean id="messageSource" class="com.hand.hap.core.i18n.CacheMessageSource"/>
<!-- config transactionManager -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mapperLocations" value="classpath*:/**/*Mapper.xml"/>
<property name="plugins">
<array>
<bean class="com.hand.hls.interceptor.MysqlDialectInterceptor"/>
<bean class="com.hand.hls.interceptor.OracleDialectInterceptor"/>
<bean class="com.hand.hap.core.interceptor.RequestContextInterceptor"/>
<bean class="com.hand.hap.core.interceptor.MultiLanguageInterceptor"/>
<bean class="com.hand.hap.core.interceptor.SecurityTokenInterceptor"/>
<bean class="com.hand.hap.core.interceptor.OvnInterceptor"/>
<bean class="com.hand.hap.core.interceptor.AuditInterceptor"/>
<bean class="com.github.pagehelper.PageHelper"/>
<bean class="com.hand.hap.core.interceptor.CacheJoinInterceptor">
<property name="cacheJoinType" ref="cacheJoinType"></property>
</bean>
</array>
</property>
<property name="configLocation" value="classpath:mybatis-configuration.xml"/>
</bean>
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" name="sqlSessionFactory" ref="sqlSessionFactory"/>
</bean>
<!-- mapper definition -->
<bean id="mapperScannerConfigurer" class="com.hand.hap.mybatis.spring.MapperScannerConfigurer">
<property name="basePackage" value="*.**.mapper"/>
<property name="processPropertyPlaceHolders" value="true"/>
<property name="propertiesMap">
<map>
<entry key="mappers" value="com.hand.hap.mybatis.common.Mapper"/>
<entry key="IDENTITY" value="${mybatis.identity}"/>
<entry key="dataBaseType" value="${db.type}"/>
<entry key="seqFormat" value="{3}_s.nextVal"/>
<entry key="enableMethodAnnotation" value="true"/>
</map>
</property>
<!--<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>-->
</bean>
<context:component-scan base-package="**.*.service"/>
<context:component-scan base-package="**.*.components"/>
<bean id="requestAD" class="com.hand.hap.core.impl.ServiceExecutionAdvice"/>
<aop:config expose-proxy="true">
<aop:pointcut id="servicePointcut" expression="execution(* *..*ServiceImpl.*(..))"/>
<aop:advisor advice-ref="requestAD" pointcut-ref="servicePointcut"/>
</aop:config>
<!-- 密码加密 PasswordEncoder-->
<bean id="passwordManager" class="com.hand.hap.security.PasswordManager">
<property name="siteWideSecret" value="Zxa1pO6S6uvBMlY"/>
</bean>
<!-- 线程池 -->
<bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<!-- 核心线程数 -->
<property name="corePoolSize" value="5"/>
<!-- 最大线程数 -->
<property name="maxPoolSize" value="250"/>
<!-- 队列最大长度 -->
<property name="queueCapacity" value="1000"/>
<!-- 线程池维护线程所允许的空闲时间,默认为60s -->
<property name="keepAliveSeconds" value="120"/>
</bean>
<bean id="freeMarkerBeanProvider" class="com.hand.hap.core.web.FreeMarkerBeanProvider"/>
<bean id="distributeLockTemplate" class="com.hand.hap.lock.impl.DistributedLockFactoryBean">
<property name="mode" value="MULTIPLE"/>
</bean>
</beans>