Skip to content

ControllerLinkBuilderFactory should resolve placeholders #220

@51f0x

Description

@51f0x

The ControllerLinkBuilderFactory does not resolve placeholders in RequestMapping annotations.

Ex. @RequestMapping(value = "${myPath}/users")

The handling should be the same as in the RequestMappingHandlerMapping.

Stacktrace:

java.lang.IllegalArgumentException: Map has no value for 'myPath'
at org.springframework.web.util.UriComponents$MapTemplateVariables.getValue(UriComponents.java:277) ~[spring-web-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.web.util.UriComponents.expandUriComponent(UriComponents.java:221) ~[spring-web-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.web.util.HierarchicalUriComponents$FullPathComponent.expand(HierarchicalUriComponents.java:642) ~[spring-web-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.web.util.HierarchicalUriComponents.expandInternal(HierarchicalUriComponents.java:311) ~[spring-web-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.web.util.HierarchicalUriComponents.expandInternal(HierarchicalUriComponents.java:46) ~[spring-web-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.web.util.UriComponents.expand(UriComponents.java:152) ~[spring-web-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.web.util.UriComponentsBuilder.buildAndExpand(UriComponentsBuilder.java:288) ~[spring-web-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.hateoas.mvc.ControllerLinkBuilderFactory.linkTo(ControllerLinkBuilderFactory.java:145) ~[spring-hateoas-0.15.0.RELEASE.jar:na]
at org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo(ControllerLinkBuilder.java:135) ~[spring-hateoas-0.15.0.RELEASE.jar:na]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions