admin管理员组文章数量:1333196
I am trying to convert the following
me:
cxf:
jaxws:
services:
myconfig:
retry:
enabled: true
sleuth:
enabled: true
The problem here is this can be in properties or YAML. I need to change it to
me:
cxf:
jaxws:
services:
myconfig:
retry:
enabled: true
observation:
enabled: true
I tried
- .openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: me.cxf.jaxws.services.*.sleuth
newPropertyKey: me.cxf.jaxws.services.{*}.observation
and
- .openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: me.cxf.jaxws.services.*.sleuth
newPropertyKey: me.cxf.jaxws.services.*.observation
But these end up removing the myconfig
services:
- myconfig:
- observation:
+ {*}.observation:
enabled: true
So what is the correct way to use dynamic paths with the ChangeSpringPropertyKey?
I can't use ChangeKey because it only works for yaml and not .properties
update
So I was thinking about using both the ChangeKey and ChangeSpringPropertyKey but the problem seems to be based on the docs this wouldn't work for properties either. for example if I had
a.b.c.property=Something
a.f.c.otherProperty=Something
And I wanted to change it to
a.b.d.property=Something
a.f.d.otherProperty=Something
based on the docs I see here
The new name for the property key.
with no mention of glob vs the old one which does support it
The property key to rename. Supports glob
I am trying to convert the following
me:
cxf:
jaxws:
services:
myconfig:
retry:
enabled: true
sleuth:
enabled: true
The problem here is this can be in properties or YAML. I need to change it to
me:
cxf:
jaxws:
services:
myconfig:
retry:
enabled: true
observation:
enabled: true
I tried
- .openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: me.cxf.jaxws.services.*.sleuth
newPropertyKey: me.cxf.jaxws.services.{*}.observation
and
- .openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: me.cxf.jaxws.services.*.sleuth
newPropertyKey: me.cxf.jaxws.services.*.observation
But these end up removing the myconfig
services:
- myconfig:
- observation:
+ {*}.observation:
enabled: true
So what is the correct way to use dynamic paths with the ChangeSpringPropertyKey?
I can't use ChangeKey because it only works for yaml and not .properties
update
So I was thinking about using both the ChangeKey and ChangeSpringPropertyKey but the problem seems to be based on the docs this wouldn't work for properties either. for example if I had
a.b.c.property=Something
a.f.c.otherProperty=Something
And I wanted to change it to
a.b.d.property=Something
a.f.d.otherProperty=Something
based on the docs I see here
The new name for the property key.
with no mention of glob vs the old one which does support it
Share Improve this question edited Nov 20, 2024 at 16:08 JGleason asked Nov 20, 2024 at 15:37 JGleasonJGleason 3,9586 gold badges29 silver badges61 bronze badgesThe property key to rename. Supports glob
1 Answer
Reset to default 1Thanks for sharing your findings! Indeed there seems to be a mismatch here: the ChangeSpringPropertyKey recipe delegates to two other recipes, which do not both support the same format. As such I've for now removed the indication that glob is supported, and we'll circle back to try to add that in.
There's some related work being done here that should make this easier to add:
- https://github/openrewrite/rewrite/pull/4708
本文标签: springHow do I use wildcards with ChangeSpringPropertyKey OpenRewrite RecipeStack Overflow
版权声明:本文标题:spring - How do I use wildcards with ChangeSpringPropertyKey OpenRewrite Recipe - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742348024a2457921.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论