spring整合redis之Redis配置文件

导包:jedis / spring-data-redis

注意缓存穿透问题及缓存穿透解决办法

需要 关闭Linux防火墙、将redis的配置文件中的protected-mode改为no,其Linux命令为:config set protected-mode no(进入配置文件命令:config get *)

1.spring-redis.xml

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
 4        xsi:schemaLocation="http://www.springframework.org/schema/beans
 5         http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
 6 
 7     <mvc:default-servlet-handler/>
 8     <mvc:annotation-driven/>
 9 
10 
11     <mvc:annotation-driven>
12         <mvc:message-converters>
13             <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
14                 <property name="objectMapper" ref="objectMapper"/>
15             </bean>
16         </mvc:message-converters>
17     </mvc:annotation-driven>
18 
19     <bean id="objectMapper" class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean"/>
20 
21 
22 </beans>
历经苦难而不厌,此乃阿修罗之道。
原文地址:https://www.cnblogs.com/echo1314/p/10287029.html