use of io.leopard.redis.Redis in project leopard by tanhaichao.
the class AlldbBeanPostProcessor method initRedisHashs.
protected boolean initRedisHashs(Field field, AlldbImpl alldb) {
Hashs hashs = field.getAnnotation(Hashs.class);
if (hashs == null) {
return false;
}
String redisBeanId = hashs.redis();
Redis redis = (Redis) beanFactory.getBean(redisBeanId);
HashsImpl hashsImpl = new HashsImpl();
hashsImpl.setRedis(redis);
hashsImpl.setKey(hashs.key());
hashsImpl.setFieldPattern(hashs.field());
alldb.setHashsImpl(hashsImpl);
return true;
}
use of io.leopard.redis.Redis in project leopard by tanhaichao.
the class LeopardHandlerMapping method initApplicationContext.
@Override
protected void initApplicationContext(ApplicationContext context) throws BeansException {
try {
Redis redis = (Redis) context.getBean("sessionRedis");
StoreRedisImpl.setRedis(redis);
} catch (NoSuchBeanDefinitionException e) {
logger.warn("没有配置sessionRedis,不启用分布式session.");
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
super.initApplicationContext(context);
requestMappingInfoBuilder = new RequestMappingInfoBuilderImpl(context);
}
use of io.leopard.redis.Redis in project leopard by tanhaichao.
the class SysconfigBeanPostProcessor method setBeanFactory.
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
this.beanFactory = (ConfigurableListableBeanFactory) beanFactory;
jdbc = (Jdbc) beanFactory.getBean("jdbc");
Redis redis = (Redis) beanFactory.getBean("sessionRedis");
Publisher.listen(this, redis);
}
use of io.leopard.redis.Redis in project leopard by tanhaichao.
the class MemdbRsyncImplTest method init.
@Test
public void init() {
Redis redis = Mockito.mock(Redis.class);
MemdbRsyncImpl memdb = new MemdbRsyncImpl(10);
memdb.setRedis(redis);
memdb.setChannel("channel");
memdb.init();
Assert.assertNotNull(memdb.memdbRsyncService);
memdb.destroy();
}
use of io.leopard.redis.Redis in project leopard by tanhaichao.
the class DynamicEnumScannerConfigurer method setApplicationContext.
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
// logger.info("setApplicationContext");
this.applicationContext = applicationContext;
jdbc = (Jdbc) applicationContext.getBean("jdbc");
Redis redis = (Redis) applicationContext.getBean("sessionRedis");
Publisher.listen(this, redis);
}
Aggregations