spring-projects / spring-projects/spring-data-rest
When an exception is thrown it is not getting returned in JSON even with AnnotationMethodHandlerExceptionResolver [DATAREST-139]
Open
@odrotbohm is already working on this.
Since Dec 31, 2020.
type: bug
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Thomas Darimont opened DATAREST-139 and commented
Github Author: vijaygrk
Github Last-Updated: 2013-03-25T01:45:30Z
This issue was automatically imported from github
Here is what i have in my application config.
The response type is always set to text/html when an exception is thrown
@Bean
public StringHttpMessageConverter stringHttpMessageConverter() {
return new StringHttpMessageConverter();
}
@Bean
public MappingJacksonHttpMessageConverter jsonHttpMessageConverter() {
return new MappingJacksonHttpMessageConverter();
}
@Bean
public AnnotationMethodHandlerExceptionResolver methodHandlerExceptionResolver() {
AnnotationMethodHandlerExceptionResolver annotationMethodHandlerExceptionResolver = new
AnnotationMethodHandlerExceptionResolver();
annotationMethodHandlerExceptionResolver.setOrder(1);
HttpMessageConverter[] messageConvertersList = {jsonHttpMessageConverter()};
annotationMethodHandlerExceptionResolver.setMessageConverters(messageConvertersList);
return annotationMethodHandlerExceptionResolver;
}
Reference URL: https://api.github.com/repos/SpringSource/spring-data-rest/issues/84
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.