I have Spring STS installed on my machine and i am creating rest api's in java and accessing it using the url http://localhost:8080/projectname/apiname. I have visual studio installed on the same machine and trying to access the api i created. But when i try to access it in localhost:4200, i am getting the following error.
The Same Origin Policy disallows reading the remote resource at http://localhost:8080/org/getRecord/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
The same works fine in postman.
I have added the cors allowed origin in my web.xml file
<init-param>
<param-name>cors.allowed.origins</param-name>
<param-value>*</param-value>
</init-param>