All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.liuanxin.caches.RedisContextUtils Maven / Gradle / Ivy

There is a newer version: 1.2.7
Show newest version
package com.github.liuanxin.caches;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.data.redis.core.RedisTemplate;

public class RedisContextUtils implements ApplicationContextAware {

    private static ApplicationContext context;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        context = applicationContext;
    }

    @SuppressWarnings("unchecked")
    static RedisTemplate getRedisTemplate() {
        return (RedisTemplate) context.getBean("redisTemplate");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy