dawdler-server-plug-jedis
模块介绍
实现dawdler-server端注入JedisOperator的功能.
1. pom中引入依赖
<groupId>club.dawdler</groupId>
<artifactId>dawdler-server-plug-jedis</artifactId>
2. 使用方式
通过@JedisInjector注解标识全局变量为JedisOperator类型的变量即可.
public class UserServiceImpl implements UserService {
@JedisInjector("myRedis")//myRedis为配置文件的名称,不包含后缀properties
JedisOperator jedisOperator;
public User getUser(String userId) {
jedisOperator.set("userId", userId);//使用jedisOperator对象
return null;
}
}