spring-hateoas
spring-hateoas copied to clipboard
WebMvcLinkBuilder does not resolve "EmmbeddedValues" correctly.
trafficstars
When using "Embedded Values" in spring, WebMvcLinkBuilder does not correctly resolve the value. This does not seem to be an esoteric way of writing a RestController, as among other things this is how the OpenAPI generator generates server stubs.
Example:
@RestController
@RequestMapping("${openapi.example.base-path:/example}")
public class HelloController {
}
Failing Test:
@Test
void LinkBuilderAndSpringEmbeddedValueResolver() {
var result = WebMvcLinkBuilder.linkTo(HelloController.class)
.withRel("example");
assertThat(result).extracting(Link::getHref).isEqualTo("http://localhost/example");
}
Result:
expected: "http://localhost/example"
but was: "http://localhost/example}"