spring-boot: HATEOAS: ResponseEntity from @ExceptionHandler method not converted to HAL

Given a controller like https://github.com/mvitz/spring-boot-hateoas-autoconfiguration-bug/blob/master/src/main/java/de/mvitz/spring/hateoas/server/ExceptionController.java with a @ExceptionHandler annotated method the response is not converted to valid HAL, see:

curl -i localhost:8080/exception -HAccept:application/hal+json
HTTP/1.1 400
Content-Type: application/hal+json;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 02 Feb 2017 00:05:02 GMT
Connection: close

{"links":[{"rel":"self","href":"http://google.de"}],"message":"Foo"}

Maybe I am (again) missing some little thing here but I think given the example controller I should expect to receive a response with valid HAL.

Issue occurs with Spring-Boot 1.4.4.RELEASE and 1.5.1.RELEASE as well.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

We’ve just pushed some significant configuration changes to Spring HATEOAS (both on master as well on the bugfix branch for the upcoming 0.25.0) in the context of spring-projects/spring-hateoas#719 and spring-projects/spring-hateoas#723. I’ve adapted Spring Data REST to work with these changes (coming in Lovelace) and verified our Spring Data examples work with these changes on Boot 2.0.3. Find the details of what has changed in the tickets I linked above.

I’d like to encourage everyone who brought up issues in this ticket to try to upgrade to Spring HATEOAS 0.25.0.BUILD-SNAPSHOT (it doesn’t contain any major changes but the ones just described), give it a spin and report problems you (still see) in spring-projects/spring-hateoas#719.