redisson配置

/**
 * redisson cache manager
 */
@Configuration
@ComponentScan
@EnableCaching
public class RedissonConfig {

	@Bean(destroyMethod="shutdown")
    public RedissonClient redisson(@Value("classpath:/redisson-server.json") Resource configFile) throws IOException {
		Config config = Config.fromJSON(configFile.getInputStream());
        return Redisson.create(config);
    }

    @Bean
    public CacheManager cacheManager(RedissonClient redissonClient) throws IOException {
        return new RedissonSpringCacheManager(redissonClient, "classpath:/redisson-cache.json");
    }

}

猜你喜欢

转载自ln-software.iteye.com/blog/2353875