Closed
Description
George Shan Lyons opened SPR-11885 and commented
In previous versions, the following was possible:
final UriComponentsBuilder commonUri = UriComponentsBuilder.fromHttpUrl("http://thing.com").pathSegment("/somePath");
UriComponents url1 = commonUri.build();
UriComponents url2 = commonUri.pathSegment("additionalPath").build();
Unfortunately, the state is now internally shared, I believe through a List of PathComponentBuilders, such that the change to the builder in url2 affects url1. The expectation is that, once build is called, the UriComponents instance is no longer mutable through the builder.
Workaround is simple, just create 2 builders.
Affects: 3.2.8
Issue Links:
- UriComponentsBuilder and ServletUriComponentsBuilder generate URLs with empty segments [SPR-10270] #14904 UriComponentsBuilder and ServletUriComponentsBuilder generate URLs with empty segments
Referenced from: commits 247771c, d239016, c73ac07
Backported to: 3.2.10