Version: 5.2.5-RELEASE
We're using spring hateoas (webflux version) and noticed that our links have a missing slash between the context path and the controller RequestMapping.path.
Adding slashes to the RequestMapping.path is a workaround, but shouldn't be needed.
The method below seems to be the culprit.
If psBuilder == null and fpBuilder != null, no slash is added.
public void addPath(String path) {
if (StringUtils.hasText(path)) {
PathSegmentComponentBuilder psBuilder = getLastBuilder(PathSegmentComponentBuilder.class);
FullPathComponentBuilder fpBuilder = getLastBuilder(FullPathComponentBuilder.class);
if (psBuilder != null) {
path = (path.startsWith("/") ? path : "/" + path);
}
if (fpBuilder == null) {
fpBuilder = new FullPathComponentBuilder();
this.builders.add(fpBuilder);
}
fpBuilder.append(path);
}
}
Comment From: rstoyanchev
This is intentional. The path(String) method operates on a full path as appending to the same string. See for example this test. Only when working with pathSegment(String...) do we fill in slashes if missing.
At best we can improve the Javadoc on path(String). This definitely needs to be specified so I'll schedule this for a change..