Spring MVC has implicit CORS support, so to use the controller method CORS configuration with @CrossOrigin annotation in your Spring Boot application does not require any specific configuration.
The global CORS configuration can be defined by registering a WebMVCConfigurer bean with a customized addCorsMappings(CorsRegistry) method, as you can see in the code below:
@Configurationpublic class MyConfiguration { @Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurerAdapter() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/api/**"); } }; }}