首页>代码>springboot整合jedis项目实例>/springboot-jedis/src/main/java/com/trq/springbootjedis/Util/JedisUtil.java
package com.trq.springbootjedis.Util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

@Component
public class JedisUtil {
    @Autowired
    private JedisPool jedisPool;

    /**
     * 获取Jedis
     */
    public Jedis getJedis() {

        return jedisPool.getResource();
    }

    /**
     * 关闭Jedis连接
     */
    public void close(Jedis jedis) {
        if(jedis != null) {
            jedis.close();
        }
    }

    // .....可以自行封装其他方法
}
最近下载更多
wxd1997  LV13 4月16日
是一个鸽子啊  LV17 2023年6月14日
1145304128  LV12 2021年12月1日
shiopaaa  LV13 2021年11月23日
尹恒yingying  LV18 2021年10月21日
安东尼online  LV11 2021年7月15日
123456nty  LV37 2021年6月6日
wcy071213  LV27 2020年8月22日
skipple3  LV39 2020年5月31日
bjgaocl  LV13 2020年3月21日
最近浏览更多
wxd1997  LV13 4月16日
zhujunnan  LV12 3月19日
guoshuai09  LV4 3月13日
唐唐丶  LV33 2023年11月14日
wnnmmb  LV2 2023年10月19日
是一个鸽子啊  LV17 2023年6月14日
guviva  LV6 2023年5月29日
1025490081  LV2 2022年11月9日
包呼和  LV10 2022年10月19日
罗清晨  LV11 2022年10月1日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友