Search in sources :

Example 1 with Redis

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;
}
Also used : Redis(io.leopard.redis.Redis)

Example 2 with Redis

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);
}
Also used : Redis(io.leopard.redis.Redis) NoSuchBeanDefinitionException(org.springframework.beans.factory.NoSuchBeanDefinitionException) BeansException(org.springframework.beans.BeansException) NoSuchBeanDefinitionException(org.springframework.beans.factory.NoSuchBeanDefinitionException) RequestMappingInfoBuilderImpl(io.leopard.vhost.RequestMappingInfoBuilderImpl)

Example 3 with Redis

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);
}
Also used : Redis(io.leopard.redis.Redis)

Example 4 with 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();
}
Also used : Redis(io.leopard.redis.Redis) Test(org.junit.Test)

Example 5 with Redis

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);
}
Also used : Redis(io.leopard.redis.Redis)

Aggregations

Redis (io.leopard.redis.Redis)8 RedisImpl (io.leopard.redis.RedisImpl)1 RequestMappingInfoBuilderImpl (io.leopard.vhost.RequestMappingInfoBuilderImpl)1 Test (org.junit.Test)1 BeansException (org.springframework.beans.BeansException)1 NoSuchBeanDefinitionException (org.springframework.beans.factory.NoSuchBeanDefinitionException)1