您现在的位置是: 首页 > 后端开发 记一次Java MessageFormat.format踩坑
记一次Java MessageFormat.format踩坑
2020-05-20 【后端开发】 1953人已围观 4019次浏览
简介记一次Java MessageFormat.format踩坑
在做三方登录时,需要涉及到处理请求中随机校验码state参数的问题。
Spring Boot 中配置文件,使用MessageFormat占位符方式。
https://open.weixin.qq.com/connect/qrconnect?appid={0}&redirect_uri={1}&response_type=code&scope={2}&state={3}#wechat_redirect
实际处理方法
url = MessageFormat.format(url, APPID, REDIRECT_URI, SCOPE, STATE);
在处理上诉地址时,出现随机校验码state一直是第一次生成出来的随机数,并且在多部设备中测试三方登录时,运行日志中显示,随机数参数一直都是第一次生成出来的参数。
多次尝试查不到原因后,改回原始拼接字符串方式解决。
具体原因研究中,查到后更新!!!
===================================================================
2018年07月31日02:27:48 更新
上诉问题,并不是MessageFormat.format用法问题。
测试出来发现Spring Boot注解
@Value(“${weixin.url}”)
private String url;
在进行
url = url + XXXXXX
类似的操作时,会出现XXXXXX是第一次请求时生成的随机数问题。
具体原理研究中,问题进展持续更新……
很赞哦! (0)
相关文章
- PHP 在执行 composer install 时出现提示 PHP Fatal error: Allowed memory size of XXXXXX bytes exhausted <...>
- RocketMQ 出现 sendDefaultImpl call timeout 问题
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- 删除Git仓库所有历史提交记录,成为一个干净的仓库
- 获取阿里云CDN真实IP
- 记一次 Mybatis-Plus 自动填充无效问题解决
- SpringBoot 定时任务 多线程
- PHP 中list()出现Undefined offset: 0错误
- springboot引入mybatis-plus后出现ClassNotFoundException: org.mybatis.logging.LoggerFactory
- Laravel Dingo/api 出现 The version given was unknown or has no registered routes.报错
点击排行
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- Debian apt 使用国内镜像
- RocketMQ 出现 sendDefaultImpl call timeout 问题
- 类 BASE64Decoder 程序包 sun.misc 找不到符号
- SpringBoot @NotBlank 不生效问题
- 记一次 Mybatis-Plus 自动填充无效问题解决
- nuxt 项目完整部署方案
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
站长推荐
猜你喜欢
- gulp3 在 node12 上运行出现异常 primordials is not defined
- nginx 出现 the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in 错误解决方案
- CentOS 7 安装 Golang 环境
- SpringBoot 启动提示 Requested bean is currently in creation: Is there an unresolvable circular reference?
- Linux 服务器之间传输大文件(压缩文件、查看MD5、后台传输)
- 查看MySQL默认读取的配置文件
- mac idea spring boot 启动慢
- mysql 索引过长1071-max key length is 767 byte
- python scrapy 出现 DEBUG: Filtered offsite request to 错误
- 【代码片段】MySQL 查看数据库所有表注释