spring-hateoas
spring-hateoas copied to clipboard
HATEOAS - Does not render _links correctly
Problem:
Server does not add the underscores to the field names and the configuration how to do it correctly is missing for xml based configuration in Jakarta EE environments (war files)
Example:
{"hello":"Hello World","links":[{"rel":"self","href":"http://localhost:8080/hateoas-1.0-SNAPSHOT/mvc/hello-world"}]}
Expected:
- Solution A: There is some documentation how to initialize it correctly in XML based environments
- Solution B: There is an actual bug and the bug is fixed
How to reproduce
Example project: Repo https://github.com/fabianfrz/spring-hateoas-bug-example curl http://localhost:8080/hateoas-1.0-SNAPSHOT/mvc/hello-world -H "Accept: application/hal+json"
Additional Information
If the you add the EnableWebMVC annotation, it is starting up, however it seems to configure a different request handler than the one that is actuallly in use. See screenshot. If we don't add the annotation, the augment method is never called.

The documentation outlines that you need a configuration class annotated with @EnableHypermediaSupport. Does that help?
If you'd like us to investigate the sample repo, please ensure it can be run as is (via a test case) and shows the problem.
@odrotbohm the annotation is in use by the example project: https://github.com/fabianfrz/spring-hateoas-bug-example/blob/master/src/main/java/com/example/hateoas/EnableHypermedia.java
You can just compile it and deploy it on a WildFly or JBoss server. to get the same environment as we use.
You should get the war if you run maven package and then you can copy the WAR file into WildFly's deploy directory. Then you can reproduce it. If you own a Pro version of IntelliJ IDEA, you can deploy directory from that via a startup config.