Skip to content
Advertisement

Internal Server Error When Adding WebMvcConfigurer To Spring Boot Rest Application

I have a Spring Boot app and I wanted to allow other origins to make requests because I got the ‘cors’ error. So I searched and I found this answer: Annotation CrossOrigin not working in Spring boot witch helped for the endpoints that have no body. On the other hand, those who have a body I get Internal Server Error.

enter image description here

Below is the configuration:

JavaScript

The controllers have the @RestController annotation and the methods @Get/Post|Mapping. They return a ResponseEntity<Object>.

Advertisement

Answer

I solved it by putting the following method in main class.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement