spring-session之3 redis配置参数配置
前文,我们 spring-session之2 依葫芦画瓢做个小项目
, 做了一个非常简单的小例子,现在我们需要修改redis相关参数,总不能老是使用 localhost:6379
吧, 怎么办? 以及 spring-session
还有哪些参数可以修改?
好,今天的目标是:
- 修改
spring-session
redis ip以及端口参数 - 了解
spring-session
redis 还有什么其他参数
1. 修改ip和端口号
为了演示方便, 这里把默认的本地地址(localhost)换成内网地址
先查询下 ipconfig
内网地址
是 10.88.54.169
再修改 spring-session.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:annotation-config />
<!-- RedisHttpSessionConfiguration -->
<bean class="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration" />
<!--JedisConnectionFactory -->
<bean class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="hostName" value="10.88.54.169" />
<property name="port" value="6379" />
</bean>
</beans>
重启应用
项目启动成功
并且成功链接redis
2.JedisConnectionFactory 还有什么其他属性?
通常要看 一个bean 有哪些参数可以设置,看他有什么 set 方法
参数表格一览:
convertPipelineAndTxResults | boolean | Specifies if pipelined results should be converted to the expected data type. If false, results of JedisConnection.closePipeline() and JedisConnection.exec() will be of the type returned by the Jedis driver | true |
database | int | Sets the index of the database used by this connection factory. | 0 |
hostName | String | redis 地址 | localhost |
password | String | password used for authenticating with the Redis server. | 无 |
poolConfig | JedisPoolConfig | Sets the pool configuration for this factory | new JedisPoolConfig() |
port | int | redis 连接端口号 | 6379 |
shardInfo | JedisShardInfo | Sets the shard info for this factory. | 无 |
timeout | int | redis 连接超时时间 | 2000 |
usePool | boolean | Turns on or off the use of connection pooling | true |
--to be continued
相关推荐
session-redis-explorer.jar然后访问配置配置描述spring.redis.host Redis服务器的主机名spring.redis.port Redis服务器的端口server.port 传入HTTP请求的侦听端口您可以通过几种方式(命令行参数, application.yml...
data-redis|[lettuce,redis,session redis,YAML配置,连接池,对象存储](https://github.com/smltq/spring-boot-demo/blob/master/data-redis/HELP.md) quartz|[Spring Scheduler,Quartz,分布式调度,集群,mysql持久化...
这里之前的配置有问题,因为参数类型不一致,有时候jar和环境的问题,导致参数根据index对应,会处理问题, 理论上加另一个 name,就可以解决,现在把name 和type都加上,更保险。 --> 二、登录获取上一个URL...
spring-boot-starter-redis spring-boot-starter-security spring-boot-starter-social-facebook spring-boot-starter-social-linkedin spring-boot-starter-social-twitter spring-...
MyBatis | ORM框架 | [http://www.mybatis.org/mybatis-3/zh/index.html](http://www.mybatis.org/mybatis-3/zh/index.html) MyBatis Generator | 代码生成 | [http://www.mybatis.org/generator/index.html]...
从Spring配置分离@Entity定义 v. 67.5. 配置JPA属性 vi. 67.6. 使用自定义的EntityManagerFactory vii. 67.7. 使用两个EntityManagers viii. 67.8. 使用普通的persistence.xml ix. 67.9. 使用Spring Data JPA和...
首页修改 dateformat.js 时间参数转换 SpringMVC配置文件集中 快递参数接口 1.1.4 des加解密字符串和文件 1.1.5 redis 加锁,redis升级成2.8.2 freemarker工具类 1.1.6 spring websocket 实现在线聊天 maven升级...
循序渐进,学习Spring Boot、Spring Boot & Shiro、Spring Cloud、Spring Security & Spring Security OAuth2,博客Spring系列源码 一、Spring Boot教程 开启Spring Boot Spring Boot基础配置 Spring Boot中使用...
学习了自己通过 cookie 实现分布式session, 不使用spring boot默认提供的 知识点 数据库设计 明文密码两次md5处理 JSR303参数校验 + 全局异常处理器 分布式session, 通过cookie完成分布式session功能. 将cookie存放...
首页修改 dateformat.js 时间参数转换 SpringMVC配置文件集中 快递参数接口 1.1.4 des加解密字符串和文件 1.1.5 redis 加锁,redis升级成2.8.2 freemarker工具类 1.1.6 spring websocket 实现在线聊天 maven升级...
Maven Spring(IOC DI AOP 声明式事务处理) SpringMVC(支持Restful风格) Hibernate Validate(参数校验) Mybatis(最少配置方案) ...Tomcat集群(Redis共享Session) Sping Shiro权限控制(待完善)
首页修改 dateformat.js 时间参数转换 SpringMVC配置文件集中 快递参数接口 1.1.4 des加解密字符串和文件 1.1.5 redis 加锁,redis升级成2.8.2 freemarker工具类 1.1.6 spring websocket 实现在线聊天 maven升级...
首页修改 dateformat.js 时间参数转换 SpringMVC配置文件集中 快递参数接口 1.1.4 des加解密字符串和文件 1.1.5 redis 加锁,redis升级成2.8.2 freemarker工具类 1.1.6 spring websocket 实现在线聊天 maven升级...
Spring-Session日志管理:SLF4J、Log4j2前端框架:Angular JS + Bootstrap + Jquery启动说明:* 项目依赖activemq、Redis和ZooKeeper服务。* 使用nginx代理UI:修改配置里的UI目录后重启nginx。* 启动方法:...
首页修改 dateformat.js 时间参数转换 SpringMVC配置文件集中 快递参数接口 1.1.4 des加解密字符串和文件 1.1.5 redis 加锁,redis升级成2.8.2 freemarker工具类 1.1.6 spring websocket 实现在线聊天 maven升级...
- 支持分布式部署,session存储在redis中 - 友好的代码结构及注释,便于阅读及二次开发 - 引入quartz定时任务,可动态完成任务的添加、修改、删除、暂停、恢复及日志查看等功能 - 页面交互使用Vue2.x,极大的提高了...
参数管理:对系统动态配置常用参数。 通知公告:系统通知公告信息发布维护。 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。 登录日志:系统登录日志记录查询包含登录异常。 在线用户:当前...
参数管理:对系统动态配置常用参数。 通知公告:系统通知公告信息发布维护。 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。 登录日志:系统登录日志记录查询包含登录异常。 在线用户:当前...
基于SpringBoot 2.0,SpringMVC,Mybatis,mybatis-plus,motan/dubbo分布式,Redis缓存,Shiro权限管理,redis管理Session,Quartz分布式集群调度,Restful服务;系统管理:包括用户管理、权限管理、数据字典、系统...