Skip to content

Spring property resolved in @RequestMapping but not in Hateos link #696

@Rashin46

Description

@Rashin46

I wanted to create custom mapping based on some spring property. What I did was adding the spring property to RequestMapping like this:

@RequestMapping(value = "/api/${property.version}", produces = HAL_JSON_VALUE)

My application.properties contains only this property:
property.version=v2

And if I start the service I can see that the property has been resolved:
Mapped "{[/api/v2/hello],methods=[GET],produces=[application/hal+json]}" onto public com.test.hateos.testhateos.domain.Message com.test.hateos.testhateos.controller.HomeController.hello()

However the generated self link for my resource does not resolve this property:

"_links": {
    "self": {
        "href": "http://localhost:8080/api/${property.version}/hello"
    }
}

I was expecting that the property will be resolved in the self link too.
See my test project attached.
You can find a failing test regarding this problem.

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