Files
MaxKey/maxkey-web-maxkey/src/main/resources/spring/maxkey-persistence.xml
shimingxy bc8fbe3a47 v1.3.1 FIX
1、验证增强,增加算术验证码支持
2、修复新增用户时报错
3、修复操作日志报错
4、mybatis-jpa-extra升级到v2.0
2020-04-24 15:35:28 +08:00

103 lines
4.4 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
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"
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.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">
<!-- dataSource define begin -->
<!-- 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}"/>
<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" />
<property name="dialect" value="mysql" />
<property name="timeout" value="30" />
<property name="transactionFactory">
<bean class="org.apache.ibatis.transaction.managed.ManagedTransactionFactory" />
</property>
<property name="typeAliasesPackage"
value="
org.maxkey.domain,
org.maxkey.domain.apps,
" />
<property name="mapperLocations" value="classpath*:/org/maxkey/dao/persistence/xml/#{dataSoruceConfig.database}/*.xml" />
</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>