当前位置: 首页 > news >正文

iis 建网站手机访问从零开始建设企业网站

iis 建网站手机访问,从零开始建设企业网站,wordpress网店插件,淘宝网网页版首页登录入口设置database 不生效剖析 前言配置加载类问题commons-pool 对象池 主页传送门#xff1a;#x1f4c0; 传送 前言 事情是这样的 今天在拉取了同事的代码做redis缓存设置的时候#xff0c;发现即使已经设置了database, 但是存数据的时候还是用的默认0数据库。这引起了我的好… 设置database 不生效剖析 前言配置加载类问题commons-pool 对象池 主页传送门 传送 前言 事情是这样的 今天在拉取了同事的代码做redis缓存设置的时候发现即使已经设置了database, 但是存数据的时候还是用的默认0数据库。这引起了我的好奇遂开始琢磨是什么情况造成的这种现象。 配置 上述仅为测试代码问题为了便于维护可以这么写 spring:redis:host: ${REDIS_HOST:localhost}port: ${REDIS_PORT:6379}password: ${REDIS_PASSWORD:}database: ${REDIS_DATABASE:0}加载类 然后通过RedisConfiguration 加载 ConfigurationProperties(spring.redis) public class RedisConfiguration {private String host;private int port;private String password;private int database;// getters and setters... } 问题 上网找了一系列的文章都没解决后来仔细观察研究发现是database多了个空格正确的该是这样没想到一个空格浪费了这么多时间 信心满满的以为这就万事大吉了结果一运行发现依然不可以后又开始检查,最后发现是少了几个依赖 发现没有引入commons-pool2依赖加上了依赖之后再运行发现已经切换了 commons-pool 对象池 引入Commons Pool对象池用于缓存Redis连接的原因是因为Lettuce本身是基于Netty的异步驱动在异步访问时并不需要创建连接池但基于Servlet模型的同步访问时连接池是有必要的。目的是为了复用对象以减少创建对象的开销所以一定记得要加这个依赖。 /*** Creates an instance that can be served by the pool and wrap it in a* {link PooledObject} to be managed by the pool.** return a {code PooledObject} wrapping an instance that can be served by the pool** throws Exception if there is a problem creating a new instance,* this will be propagated to the code requesting an object.*/PooledObject makeObject()throws Exception;/*** Destroys an instance no longer needed by the pool.* p* It is important for implementations of this method to be aware that there* is no guarantee about what state codeobj/codewill be in and the* implementation should be prepared to handle unexpected errors.* /p * p* Also, an implementation must take in to consideration that instances lost* to the garbage collector may never be destroyed.* /p** param p a {code PooledObject} wrapping the instance to be destroyed** throws Exception should be avoided as it may be swallowed by* the pool implementation.** see #validateObject* see ObjectPool#invalidateObject*/void destroyObject(PooledObject p)throws Exception;/*** Ensures that the instance is safe to be returned by the pool.** param p a {code PooledObject} wrapping the instance to be validated** return codefalse/code if codeobj/codeis not valid and should* be dropped from the pool, codetrue/codeotherwise.*/boolean validateObject(PooledObject p);/*** Reinitializes an instance to be returned by the pool.** param p a {code PooledObject} wrapping the instance to be activated** throws Exception if there is a problem activating codeobj/code,* this exception may be swallowed by the pool.** see #destroyObject*/void activateObject(PooledObject p)throws Exception;/*** Uninitializes an instance to be returned to the idle object pool.** param p a {code PooledObject} wrapping the instance to be passivated** throws Exception if there is a problem passivating codeobj/code,* this exception may be swallowed by the pool.** see #destroyObject*/void passivateObject(PooledObject p)throws Exception; 注意   Jedis 和Lettuce 是Java 操作Redis 的客户端。 在Spring Boot 1.x 版本默认使用的是Jedis 而在Spring Boot 2.x 版本默认使用的就是Lettuce。 所以如果你用的是1.x版本的话 需要把 RedisConnectionFactory factory 替换为LettuceConnectionFactory lettuceConnectionFactory 如果喜欢的话欢迎 关注 点赞 评论 收藏 一起讨论你的支持就是我✍️创作的动力
http://www.w-s-a.com/news/756725/

相关文章:

  • 公司注册网站开发的行业表述南宁在百度上建网站
  • 创建企业网站国内网站用django做的
  • 云主机网站的空间在哪制作微网站的平台
  • 长沙做网站 青创互联wordpress4.4.1
  • 宜昌哪里有专业做网站的网站开发做什么的
  • 3小说网站开发东莞网站公司哪家好
  • 做网站安全联盟解ps网站设计概述
  • 聊城公司做网站wordpress连接域名
  • 宣传网站建设的意义台州行app官网下载
  • 温州 网站优化网站开发公司前置审批
  • 网站开发具体的工作内容网站下载app免费
  • seo网站建设时文章频率昆山网站建设ikelv
  • 中天建设中瑞物资网站优化建立生育支持政策体系
  • 网站页面的宽度大网站怎样选域名
  • icp网站备案流程wordpress post 405
  • 网站怎样上传到空间重庆有多少网站
  • 用模板建商城购物网站嘉定专业网站建设
  • 网站开发与应用 论文dede手机医院网站模板
  • 织梦 网站栏目管理 很慢自学网页设计难吗
  • 茶文化建设网站的意义平顶山网站建设服务公司
  • 建设网站详细流程南京宣传片制作公司
  • 合肥网站排名什么网站做电气自动化兼职
  • 如何用api做网站交通建设门户网站
  • 阳西住房和城乡规划建设局网站长沙网站seo技巧
  • 长沙知名网站推广手机画设计图软件
  • 顺德公司做网站自己有网站怎么优化
  • 南京网站开发南京乐识专业外贸流程知乎
  • 盐田区住房和建设局网站分类网站有哪些
  • 建一个团购网站WordPress文章字号设置
  • 做漂亮的网站东营网站seo