spring-hateoas
spring-hateoas copied to clipboard
Simple solution to provide the environment.
- should work in all Spring Boot applications
- i am unsure about potential class loading issues around the static EnvironmentHolder in the StaticEnvironmentProvider (it is working in my deployments without issues so far)
- the solution provided in #1375 for #361 seems to be overengineered
- fixes #1406
I'm not sure I see the benefit of moving to this bean-based approach of getting the Environment
compared to simply pulling it out of the WebApplicationContext
if needed.
I currently do not see any method, that simply returns the WebApplicationContext
for this to work. The current implementation does not work in Spring Boot as pointed out on SO over here https://stackoverflow.com/questions/22167912/contextloader-getcurrentwebapplicationcontext-always-returns-null and in issue #1406 by @adriendengreville
Hi guys, when it will be merged? Faced exactly the same problem in spring boot.
Hi, is this ever to be merged? From reading https://github.com/spring-projects/spring-hateoas/pull/1328 I understood it was solved 2 years ago by @lyca and @odrotbohm stated its merged but for me its not working and can also not see those code changes in the latest source (using 2.6.9). Thanks for the clarification!
They don't need to be in there, as the fix for #1328 is actually a better solution than what's been suggested here. Would you mind creating a ticket and leave a few details of what exactly doesn't work, ideally with an accompanying reproducer.
Sure I created a small reproducer - thanks for reaching out and let me know if that's not the intended way of how this should be used and work.
https://github.com/romanpierson/spring-hateoas-reproducer
They don't need to be in there, as the fix for #1328 is actually a better solution than what's been suggested here. Would you mind creating a ticket and leave a few details of what exactly doesn't work, ideally with an accompanying reproducer.
As lyca pointed out #1328 did not resolve the issue for spring boot apps, since ContextLoader.getCurrentWebApplicationContext() is null in this case. Therefore PropertyResolvingMappingDiscovery.resolveProperties does not resolve the properties contained in the mapping (verified on spring boot 3.1.5, spring-hateoas 2.1.2). Therefore I think this PR is justified.
They don't need to be in there, as the fix for #1328 is actually a better solution than what's been suggested here. Would you mind creating a ticket and leave a few details of what exactly doesn't work, ideally with an accompanying reproducer.
As lyca pointed out #1328 did not resolve the issue for spring boot apps, since ContextLoader.getCurrentWebApplicationContext() is null in this case. Therefore PropertyResolvingMappingDiscovery.resolveProperties does not resolve the properties contained in the mapping (verified on spring boot 3.1.5, spring-hateoas 2.1.2). Therefore I think this PR is justified.
Completely correct... When will this fix be merged?
Not sure what's the point of requesting a reproducer to be honest .......