rewrite-spring icon indicating copy to clipboard operation
rewrite-spring copied to clipboard

Migrate `WebMvcTags` to `ServerRequestObservationConvention`

Open timtebeek opened this issue 1 year ago • 2 comments

What problem are you trying to solve?

WebMvcTags was deprecated in 3.0, for removal in 3.2 in favor of ServerRequestObservationConvention. The 3.0 release notes merely mention:

RestTemplateExchangeTagsProvider, WebClientExchangeTagsProvider, WebFluxTagsProvider, WebMvcTagsProvider and related classes have been replaced with ObservationConvention equivalents.

The before/after of this change is still a bit unclear to me; hoping someone can provide additional samples of how this API was used, and how the replacements should look in 3.2+.

timtebeek avatar May 22 '24 22:05 timtebeek

Hi @timtebeek

I could find some more information on this topic

https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#tag-providers-and-contributors-migration

Hope this helps. I will further explore on it.

Thanks, Mahi

bsmahi avatar May 23 '24 01:05 bsmahi

Thanks for the helpful link @bsmahi ; looks quite involved at first glance, especially as the methods in DefaultServerRequestObservationConvention are non static, whereas WebMvcTags did have static methods. That might complicate a migration, automated or manual.

timtebeek avatar May 23 '24 11:05 timtebeek

  • Fixed in https://github.com/openrewrite/rewrite-spring/pull/586

timtebeek avatar Oct 10 '24 18:10 timtebeek

Hi all,I'm currently migrating to springboot 3.2.9 and found webmvtags was depreacted I'm using this methods. webmvctags.method(request), webmvctags.exception(exception) webmvctgas.uri(request ,response). I ran the recipe but changes didn't get reflected.Can i k kw the replacement was on the same boat from few days.TIA

Swachithreddy avatar Dec 31 '24 04:12 Swachithreddy

@Swachithreddy Those individual methods weren't taken into account, the merged PR merely does a high level migration of the WebMvcTagsProvider implementation to ServerRequestObservationConvention. Would you be open to making this addition, or logging it as an issue?

Laurens-W avatar Jan 06 '25 10:01 Laurens-W