Enabling Cross Origin Requests for a Sprint MVC RESTful Web Service
Skip the definition of CORS, I will test 4 implementations which from Spring official document. 1. Preparation: 1-1. Create a resource controller The service was deployed at domain api.novastartupclassic.com
1 2 3 4 5 6 7 8 9 10 11 |
@RestController @RequestMapping( "/v1/authc" ) public class GreetingController { @GetMapping("/member/register") public Object register( @RequestBody Member member) { ...... return Re.ok( "Registered successfully." ).callback(); } } |
1-2.