无法注入JedisUtil
@Component public class JedisUtil { @Autowired private JedisPool jedisPool; private Jedis getResource(){ return jedisPool.getResource(); } public byte[] set(byte[] key, byte[] value) { Jedis jedis=getResource(); try { jedis.set(key,value); return value; } finally { jedis.close(); } } public void expire(byte[] key, int value) { Jedis jedis=getResource(); try { jedis.expire(key,value); } finally { jedis.close(); } } public byte[] get(byte[] key) { Jedis jedis=getResource(); try { return jedis.get(key); } finally { jedis.close(); } } public void del(byte[] key) { Jedis jedis=getResource(); try { jedis.del(key); } finally { jedis.close(); } } public Set<byte[]> keys(String shiro_session_perfix) { Jedis jedis=getResource(); try { return jedis.keys((shiro_session_perfix+"*").getBytes()); } finally { jedis.close(); } } }
public class RedisSessionDao extends AbstractSessionDAO { private final String SHIRO_SESSION_PERFIX = "shiro-session"; @Autowired private JedisUtil jedisUtil;
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.study.shiro.util.JedisUtil' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}