1.添加依赖架包: <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-redis</artifactId> <version>${spring-data-redis.version}</version> </dependency> <!-- 用于jedis-spring-data redisTe…
1.在applicationContext-redis.xml配置文件中增加如下: 申明一个cacheManager对象 用来注入到  shiro的   securityManager 属性  cacheManager 中 <!--spring rediscache--> <bean id="cacheManager" class="org.springframework.data.redis.cache.RedisCacheManager" c:…
需求: 1,保存一个key-value形式的结构到redis 2,把一个对象保存成hash形式的结构到redis 代码如下: // 保存key-value值         pushFrequencyTemplate.opsForValue().set("test_key", "test_value111");         // 读取刚才保存的key-value值         System.out.println(pushFrequencyTemplate.…
1.集成Spring 参考文献: 新建web工程: ehcache-core来自Hibernate wen.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi…
Redis的下载与安装 在Linux上使用wget http://download.redis.io/releases/redis-5.0.0.tar.gz下载源码到指定位置 解压:tar -xvf redis-5.0.0.tar.gz cd redis-5.0.0.tar.gz make:编译(如果Linux上没有装gcc编译环境,则执行yum -y install gcc-c++) make install:把Redis的cli和server添加到bin中,相当于配置环境变量 vim red…
本篇博客主要讲述的是两者的集成.不涉及到各自的详细细节和功能. 因为官方给出的文档不够具体,对新手而言通过官方文档还不可以非常快的搭建出SpringShiro的webproject.本博客将通过实际的案例提供具体的教程. 案例分析: 项目名称:假期系统 组织机构:部门 > 小组 角色:Admin, SeniorManager,TeamLeader,Developer 资源:假期Leave 权限:申请Apply,审核Review, 复核ReReview.查看View 角色级别:Admin > S…
首先当然是项目中需要增加shiro的架包依赖: <!-- shiro --> <dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-core</artifactId> <version>${shiro.version}</version> <exclusions> <exclusion> <artifa…
spring 集成的redis操作几乎都在RedisTemplate内了. 已spring boot为例, 再properties属性文件内配置好 redis的参数 spring.redis.host=127.0.0.1 spring.redis.port=6379 spring.redis.password=redispass spring.redis.database=0 spring.redis.timeout=5000 再到 Application启动类下加入以下代码: @Bean pu…
完整项目代码位于码云上,点击获取:Git地址 主要介绍一下重点配置地方: 一.application.yml文件 server: port: 8084 servlet: context-path: /testspring: ## quartz定时任务,采用数据库方式 quartz: job-store-type: jdbc #json 时间戳统一转换 jackson: date-format: yyyy-MM-dd HH:mm:ss time-zone: GMT+8 aop: proxy-tar…
依赖:spring-context,spring-MVC,shiro-core,shiro-spring,shiro-web 实话实说:web.xml,spring,springmvc配置文件好难 大致效果 代码结构(使用web骨架构建) pom.xml <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <ver…