Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

高版本spring(5.3.7以及以上)UriComponentsBuilder的URI_PATTERN发生变化,没办法识别CSE的URI(cse://appid:servicename/...)) #2631

Closed
fanjiwang1992 opened this issue Nov 5, 2021 · 6 comments · Fixed by #2635

Comments

@fanjiwang1992
Copy link
Member

No description provided.

@fanjiwang1992 fanjiwang1992 changed the title 高版本spring(5.3.12)UriComponentsBuilder的URI_PATTERN变化了,没办法识别CSE的URI(cse://appid:servicename/...)) 高版本spring(5.3.12)UriComponentsBuilder的URI_PATTERN发生变化,没办法识别CSE的URI(cse://appid:servicename/...)) Nov 5, 2021
@fanjiwang1992
Copy link
Member Author

image

@fanjiwang1992
Copy link
Member Author

UriComponentsBuilder handles invalid port numbers correctly

spring-projects/spring-framework#26905

@fanjiwang1992 fanjiwang1992 changed the title 高版本spring(5.3.12)UriComponentsBuilder的URI_PATTERN发生变化,没办法识别CSE的URI(cse://appid:servicename/...)) 高版本spring(5.3.7以及以上)UriComponentsBuilder的URI_PATTERN发生变化,没办法识别CSE的URI(cse://appid:servicename/...)) Nov 8, 2021
@liubao68
Copy link
Contributor

liubao68 commented Nov 12, 2021

这个使用方式是 servicecomb 早期设计不当导致的。 服务名 APP:SERIVCE 中的 : 会破坏 url 语义。 有如下建议:

  1. 使用 APP.SERIVCE 替换 APP:SERIVCE
  2. 解析服务名的代码做判断,如果使用了 APP:SERIVCE , 提示错误; 服务名和应用名如果包含 ., 也检查一下提示错误,建议用户使用 - 替换。 以避免 url 中 . 带来的歧义。
  3. 在 release notes体现这个变更

@develpoerX
Copy link
Contributor

建议保留并兼容老的策略。添加一个开关进行对老的写法进行校验。默认开关是打开的,只有老用户不愿意修改时,可以关闭校验开关,进行规避。

@liubao68
Copy link
Contributor

修改方案:

  1. 如果业务代码使用了 APP:SERIVCE , 打印一行警告日志, 并将 APP:SERIVCE 转换为 APP.SERIVCE 进行调用。
  2. 后续正确的用法使用 APP:SERIVCE 。

@liubao68
Copy link
Contributor

liubao68 commented Nov 22, 2021

如果 使用 APP.SERIVCE 替换 APP:SERIVCE 会涉及很多兼容性问题, 包括:

  1. 注册中心microservice的alias机制需要修改
  2. @RpcReference的名字需要修改
  3. RestTemplate的 cse://app:ms 需要修改
  4. 早期的命名规范并没有约束应用名称、微服务名称不包含., 变更规则可能导致业务错误。

特别1和2,3的修改有矛盾的地方。 这个版本暂时不做这个变更。 仍然保留老的习惯, 支持 cse://app:ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants