I have a simple project based on @RestController and AngularJS. I can send GET requests from Angular to @RestController but i could not send POST request. I have an error in
In Spring 4.2 and further releases, there is a first class support for CORS out-of-the-box. The details can be found on this page.
In the Spring classes annotated with RESTController, @CrossOrigin annotation can be used. Following code represents the same:
@CrossOrigin(origins = "http://localhost:3000", maxAge = 3600)
@RestController
public class AngularController {
}
In the above code, localhost:3000 represents Angular app URL.