Shiro Redisson 1.0.5 发布

栏目: 软件资讯 · 发布时间: 7年前

内容简介:shiro-redisson 是一个 Apache Shiro 的扩展组件,提供了基于 redis 实现的缓存和会话,以支持分布式环境下的应用。底层使用了 redisson 作为 redis 客户端。 shiro-redisson 更新说明 1.使用redisson包解决redis...

shiro-redisson 是一个 Apache Shiro 的扩展组件,提供了基于 redis 实现的缓存和会话,以支持分布式环境下的应用。底层使用了 redisson 作为 redis 客户端。

shiro-redisson 更新说明

1.使用redisson包解决redis缓存
2.解决shiro-redis使用*查询时,导致redis长时间卡死
3.解决使用spring-boot-devtools,出现ClassCastException异常

JDK

1.8

如何使用?

    引入Maven依赖或下载jar包

        <dependency>
            <groupId>com.github.fartherp</groupId>
            <artifactId>shiro-redisson</artifactId>
            <version>x.x.x</version>
        </dependency>

java使用

    @Bean
    public MyShiroRealm myShiroRealm() {
        return new MyShiroRealm();
    }
    
    @Bean
    public SessionManager sessionManager(SessionDAO redisSessionDAO, ObjectProvider<List<SessionListener>> sessionListenersProvider) {
        DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
        sessionManager.setSessionDAO(redisSessionDAO);
        sessionManager.setSessionListeners(sessionListenersProvider.getIfAvailable());
        return mySessionManager;
    }

    /**
    * 内置session监听器,保证删除session/cache冗余的数据信息
    */
    @Bean
    public List<SessionListener> sessionListener(SessionDAO redisSessionDAO, MyShiroRealm myShiroRealm) {
        return Collections.singletonList(new RedisSessionListener(redisSessionDAO, myShiroRealm));
    }

    @Bean
    public RedisCacheManager cacheManager(RedissonClient redissonClient) {
        return new RedisCacheManager(redissonClient);
    }

    @Bean
    public RedisSessionDAO redisSessionDAO(RedisCacheManager cacheManager) {
        return new RedisSessionDAO(cacheManager);
    }



以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Elements of Programming

Elements of Programming

Alexander A. Stepanov、Paul McJones / Addison-Wesley Professional / 2009-6-19 / USD 39.99

Elements of Programming provides a different understanding of programming than is presented elsewhere. Its major premise is that practical programming, like other areas of science and engineering, mus......一起来看看 《Elements of Programming》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具