2019-12-26 23:19:53 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
2019-04-29 23:53:10 +08:00
|
|
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
|
|
|
xmlns:context="http://www.springframework.org/schema/context"
|
2019-12-26 23:19:53 +08:00
|
|
|
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
|
|
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
|
|
|
xmlns:p="http://www.springframework.org/schema/p"
|
|
|
|
|
xmlns:util="http://www.springframework.org/schema/util"
|
2019-04-29 23:53:10 +08:00
|
|
|
xsi:schemaLocation="
|
2019-12-26 23:19:53 +08:00
|
|
|
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.xsd
|
|
|
|
|
http://www.springframework.org/schema/util
|
|
|
|
|
http://www.springframework.org/schema/util/spring-util.xsd
|
|
|
|
|
http://www.springframework.org/schema/mvc
|
|
|
|
|
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
|
2019-04-29 23:53:10 +08:00
|
|
|
|
|
|
|
|
<!-- dataSource define begin -->
|
2019-12-08 23:16:37 +08:00
|
|
|
<!-- dataSource configuration -->
|
|
|
|
|
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close" >
|
|
|
|
|
<!-- <property name="driverClass" value="#{dataSoruceConfig.driverClass}"/> -->
|
|
|
|
|
<property name="url" value="#{dataSoruceConfig.url}"/>
|
|
|
|
|
<property name="username" value="#{dataSoruceConfig.username}"/>
|
2019-04-29 23:53:10 +08:00
|
|
|
<property name="password" value="#{dataSoruceConfig.password}"/>
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<!-- JNDI data source configuration -->
|
|
|
|
|
<!-- jndiName is jndi name -->
|
|
|
|
|
<!-- if you don,t want use prefix 'java:comp/env/' set resourceRef to true,default is false -->
|
|
|
|
|
<!--
|
|
|
|
|
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
|
|
|
|
|
<property name="jndiName" value="jndi_maxkey_db" />
|
|
|
|
|
<property name="resourceRef" value="true" />
|
|
|
|
|
</bean> -->
|
|
|
|
|
<!-- dataSource define end -->
|
|
|
|
|
|
|
|
|
|
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
|
|
|
|
|
<property name="dataSource" ref="dataSource"></property>
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<!-- Declare a transaction manager -->
|
|
|
|
|
<!-- transaction manager, use JtaTransactionManager for global tx-->
|
|
|
|
|
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
|
|
|
|
<property name="dataSource" ref="dataSource" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<!-- Enable annotation style of managing transactions
|
|
|
|
|
<tx:annotation-driven transaction-manager="transactionManager" />-->
|
|
|
|
|
|
|
|
|
|
<!-- enable component scanning (beware that this does not enable mapper scanning!) -->
|
|
|
|
|
<context:component-scan base-package="org.maxkey.dao.service" />
|
|
|
|
|
|
|
|
|
|
<!-- enable autowire -->
|
|
|
|
|
<context:annotation-config />
|
|
|
|
|
|
|
|
|
|
<!-- enable transaction demarcation with annotations
|
|
|
|
|
<tx:annotation-driven />-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">-->
|
|
|
|
|
<bean id="sqlSessionFactory" class="org.apache.mybatis.jpa.MyBatisSessionFactoryBean">
|
|
|
|
|
<property name="dataSource" ref="dataSource" />
|
2020-04-24 15:35:28 +08:00
|
|
|
<property name="dialect" value="mysql" />
|
|
|
|
|
<property name="timeout" value="30" />
|
2019-04-29 23:53:10 +08:00
|
|
|
<property name="transactionFactory">
|
|
|
|
|
<bean class="org.apache.ibatis.transaction.managed.ManagedTransactionFactory" />
|
|
|
|
|
</property>
|
|
|
|
|
<property name="typeAliasesPackage"
|
|
|
|
|
value="
|
|
|
|
|
org.maxkey.domain,
|
|
|
|
|
org.maxkey.domain.apps,
|
|
|
|
|
" />
|
2019-12-16 21:47:33 +08:00
|
|
|
<property name="mapperLocations" value="classpath*:/org/maxkey/dao/persistence/xml/#{dataSoruceConfig.database}/*.xml" />
|
2019-04-29 23:53:10 +08:00
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
|
|
|
|
|
<constructor-arg index="0" ref="sqlSessionFactory" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- scan for mappers and let them be autowired -->
|
|
|
|
|
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
|
|
|
|
<property name="basePackage"
|
|
|
|
|
value="
|
|
|
|
|
org.maxkey.dao.persistence,
|
|
|
|
|
" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="redisConnectionFactory" class="org.maxkey.persistence.redis.RedisConnectionFactory">
|
|
|
|
|
<property name="hostname" value="${config.redis.hostname}"/>
|
|
|
|
|
<property name="port" value="${config.redis.port}"/>
|
|
|
|
|
<property name="timeOut" value="${config.redis.timeout}"/>
|
|
|
|
|
<property name="poolConfig" >
|
|
|
|
|
<bean class="redis.clients.jedis.JedisPoolConfig">
|
|
|
|
|
<property name="maxTotal" value="${config.redis.pool.maxtotal}" />
|
|
|
|
|
<property name="maxIdle" value="${config.redis.pool.maxidle}" />
|
|
|
|
|
<property name="maxWaitMillis" value="${config.redis.pool.maxwaitmillis}" />
|
|
|
|
|
<property name="testOnBorrow" value="${config.redis.pool.testonborrow}" />
|
|
|
|
|
</bean>
|
|
|
|
|
</property>
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
</beans>
|