-
Notifications
You must be signed in to change notification settings - Fork 472
Wrong marshalling from ControllerAdvice #279
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
Comments
Any news on this? |
You could use the following work-around?
|
What do you actually return from your controller advice methods? |
I return a custom object (let's call it ErrorResource) that inherits from ResourceSupport, just like I do in other controllers. If I return such an ErrorResource from a regular controller, the links are rendered correctly, so this seems to work. |
I encountered the same problem here when I added I posted my question here. |
Hi, it seems that nothing has changed since the original report. Are there any plans for a fix? |
I'm using an exception handler annotated with @ControllerAdvice in a Spring-MVC application. For some errors, I want to return a useful response containing HAL-links.
Unfortunately, those links are not rendered correctly in JSON as "_links", but rather as "links". It seems that when using @ControllerAdvice, the SerializerMixins are not configured for Jackson: Through debugging, I noticed that DefaultSerializerProvider._config.mixInAnnotations is empty here, but contains, among others, "org.springframework.hateoas.hal.ResourceSupportMixin" when marshalling from an ordinary @RestController. The content-type is correctly set to "application/hal+json".
Did I miss something? Is there a way to render correct links?
The text was updated successfully, but these errors were encountered: