In Spring boot there is an annotation @CrossOrigin which will simply add header in the response.
- For multiple:
@CrossOrigin(origins = {"http://localhost:7777", "http://someserver:8080"})
@RequestMapping(value = "/abc", method = RequestMethod.GET)
@ResponseBody
public Object doSomething(){
...
}
- If you wanna allow for everyone then simply use.
@CrossOrigin