Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to resolve place holders in @RequestMapping #1406

Open
adriendengreville opened this issue Dec 8, 2020 · 2 comments · May be fixed by #1411
Open

Unable to resolve place holders in @RequestMapping #1406

adriendengreville opened this issue Dec 8, 2020 · 2 comments · May be fixed by #1411

Comments

@adriendengreville
Copy link

Using spring-hateoas:1.2.1 with Spring Boot 2.4.0:

When a REST controller class annotated with @RequestMapping("${some-variable}/resources") returns a resource extending RepresentationModel, I get the following error :

{
"label": "uncatched exception",
"detailMessage": "Not enough variable values available to expand 'some-variable'",
"statusCode": 500
}

I pinned the issue to this suspect line in the core library :

WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext();

From what I could read, ContextLoader.getCurrentWebApplicationContext() doesn't return the expected context when using Spring Boot, and it's actually returning null when I place a breakpoint there :
image
You can see (L.92) that the resolvePlaceholders method won't be called, explaining my error since the raw string is passed on.

Any idea on how we could fix this ? :)

@adriendengreville
Copy link
Author

I only searched is the open issues for duplicate, my bad, and this has already been partially fixed: #220
PR #1375 (not yet merged) seems to fix this issue, though !

@lyca lyca linked a pull request Dec 10, 2020 that will close this issue
@Arpic
Copy link

Arpic commented Jul 18, 2022

I also ran into this issue. Is there any chance to see the linked PR merged? Or does something need to be improved on it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants