1:添加spring-data-redis1.7.1相关jar及测试代码
2:添加fastdfs的相关jar及测试代码 3:修改某些系统文件中项目名称为maat_service(有些系统配置文件里面的项目名称没有改过来)
This commit is contained in:
52
src/main/resources/applicationContext-redis.xml
Normal file
52
src/main/resources/applicationContext-redis.xml
Normal file
@@ -0,0 +1,52 @@
|
||||
<?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:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee"
|
||||
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:tool="http://www.springframework.org/schema/tool" xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xmlns:util="http://www.springframework.org/schema/util" xmlns:task="http://www.springframework.org/schema/task"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
|
||||
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.1.xsd
|
||||
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.1.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
|
||||
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd
|
||||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd"
|
||||
default-lazy-init="true">
|
||||
<!-- 加载配置文件 -->
|
||||
<context:property-placeholder
|
||||
ignore-unresolvable="true" location="classpath:jdbc.properties" />
|
||||
|
||||
<bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig">
|
||||
<property name="maxIdle" value="${redis.maxIdle}" />
|
||||
<property name="maxTotal" value="${redis.maxTotal}" />
|
||||
<property name="maxWaitMillis" value="${redis.maxWaitMillis}" />
|
||||
<property name="testOnBorrow" value="${redis.testOnBorrow}" />
|
||||
</bean>
|
||||
<!-- 默认使用数据库0,设置connectionFactory为非单例模式,方便选择redis数据库 -->
|
||||
<bean id="connectionFactory"
|
||||
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
|
||||
p:host-name="${redis.host}" p:port="${redis.port}" p:pool-config-ref="poolConfig"
|
||||
p:database="0" scope="prototype" />
|
||||
<!-- p:password="" -->
|
||||
|
||||
|
||||
<bean id="stringRedisSerializer"
|
||||
class="org.springframework.data.redis.serializer.StringRedisSerializer" />
|
||||
<bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
|
||||
<property name="connectionFactory" ref="connectionFactory" />
|
||||
<!-- 设置key和value的序列化方式,默认使用的是JdkSerializationRedisSerializer,key会被序列化为\xac\xed\x00\x056\x00 -->
|
||||
<property name="keySerializer" ref="stringRedisSerializer" />
|
||||
<property name="valueSerializer" ref="stringRedisSerializer" />
|
||||
<property name="hashKeySerializer" ref="stringRedisSerializer" />
|
||||
<property name="hashValueSerializer" ref="stringRedisSerializer" />
|
||||
<!-- 设置开启事务 -->
|
||||
<property name="enableTransactionSupport" value="true" />
|
||||
</bean>
|
||||
|
||||
|
||||
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user