diff --git a/jsowell-common/src/main/java/com/jsowell/common/core/redis/StaticRedisCache.java b/jsowell-common/src/main/java/com/jsowell/common/core/redis/StaticRedisCache.java new file mode 100644 index 000000000..8b16a5e92 --- /dev/null +++ b/jsowell-common/src/main/java/com/jsowell/common/core/redis/StaticRedisCache.java @@ -0,0 +1,27 @@ +package com.jsowell.common.core.redis; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; + +/** + * @Description 静态方法中调用redis + * @Author qizhentao + * @Date 2020/7/1 11:27 + * @Version 1.0 + */ +@Component +public class StaticRedisCache { + + @Autowired + private RedisCache redisCache; + + public static RedisCache staticRedisCache; + + // 项目启动时把redisUtil交给静态的staticRedisUtil + @PostConstruct + public void init() { + staticRedisCache = this.redisCache; + } +}