ssm框架中使用原生RedisTemplate

①首先在maven中添加jar包

   
      redis.clients
      jedis
      2.4.1
   
   
      commons-pool
      commons-pool
      1.6
   
   
      org.springframework.data
      spring-data-redis
      1.3.4.RELEASE
   
  

②然后在applicationContext.xml文件中添加下列配置:

 
    
    
        
        
        
        
        
    

    
        
        
        
        
    

    
        
        
            
        
        
            
        
        
            
        
        
            
        
    

③直接在你想要使用的地方注入使用即可:

    @Autowired
    private RedisTemplate redisTemplate;

 

 

你可能感兴趣的:(java)