做ktv的网站,淘宝客做网站好还是建群号,ps怎么做网站页面,做海报找图片的网站最近一直是以自学的状态#xff0c;想把自己学习到的知识分享给大家 #xff0c;也是好久没有写博客了。废话不多说 #xff0c;直接上代码。本次项目是 用maven 管理的.开发工具 eclipse在pom.xml文件中#xff0c;中关于redis的配置#xff1a;org.springframework.data…最近一直是以自学的状态想把自己学习到的知识分享给大家 也是好久没有写博客了。废话不多说 直接上代码。本次项目是 用maven 管理的.开发工具 eclipse在pom.xml文件中中关于redis的配置org.springframework.dataspring-data-redis1.0.2.RELEASEredis.clientsjedis2.1.0在 applicationContext.xml 中关于redis的配置?xml version1.0 encodingUTF-8?xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xmlns:contexthttp://www.springframework.org/schema/contextxmlns:aophttp://www.springframework.org/schema/aop xmlns:txhttp://www.springframework.org/schema/txxsi:schemaLocationhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-3.0.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-3.0.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-3.0.xsd在web.xml?xml version1.0 encodingUTF-8?xmlnshttp://java.sun.com/xml/ns/javaeexsi:schemaLocationhttp://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsdversion3.0Archetype Created Web ApplicationcontextConfigLocationclasspath:spring-mybatis.xml,classpath:applicationContext.xmlencodingFilterorg.springframework.web.filter.CharacterEncodingFiltertrueencodingUTF-8encodingFilter/*org.springframework.web.context.ContextLoaderListenerorg.springframework.web.util.IntrospectorCleanupListenerSpringMVCorg.springframework.web.servlet.DispatcherServletcontextConfigLocationclasspath:spring-mvc.xml1trueSpringMVC//index.jsp由于是入门的很简单的demo ,所以直接在 写Controllerpackage com.basessm.controller;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.data.redis.core.StringRedisTemplate;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;ControllerRequestMapping(redis)public class RedisController {Autowiredprivate StringRedisTemplate redisTemplate;// redis操作模板RequestMapping(test1)public void test1() {redisTemplate.opsForValue().set(fruit3,apple3);System.out.println(success1);}RequestMapping(test2)public void test2() {redisTemplate.opsForValue().set(aliceWang,alice2);String a redisTemplate.opsForValue().get(aliceWang);System.out.println(success2);System.out.println(a: a);}}这样就已经完成了一个 很基础很简单的 demo了在运行项目之前一定要记得先把redis-server 启动起来