Reputation: 1097
I have simply added @CrossOrigin
annotation like this:
@CrossOrigin(origins = "http://localhost:9090", maxAge = 3600)
@RestController
@RequestMapping("*")
But it is not adding any header related to CORS in response.
Should I have to do something more to get it work?
Thanks in advance
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9090' is therefore not allowed access.
Upvotes: 2
Views: 518
Reputation: 1097
I have resolved this issue, the problem was that I was defining
<mvc:annotation-driven/>
tag in dispacher-servlet.xml
instead of app-context.xml
and the second thing was that the schema URLs were not correct fot this mvc tag.
You can check structure of Spring-MVC and Beans in intelliJ Idea by opening Spring tab menu.
Upvotes: 1