I am trying to connect my Frontend in Angular 8 to my backend written in Java using Spring.
My Spring backend is running on Tomcat server at localhost:8080 and Angular is open on localhost:4200. When I try to register a user (or do anything), I get this error:
Access to XMLHttpRequest at 'http://localhost:8080/Revvit/users' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
In my UserController class within Spring, I've annotated the controller with
@CrossOrigin(origins= "*", allowedHeaders="*")
@Controller
public class UserController {............
However, I still get the same message in my console as noted above.
So, I'm assuming that I have to add some header allowing CORS within my Angular project, but WHERE, and HOW would I incorporate this?