Skip to content

Instantly share code, notes, and snippets.

@AndreaNicola
Last active January 28, 2020 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndreaNicola/5980bd920ea73fe8c574c406a96b6915 to your computer and use it in GitHub Desktop.
Save AndreaNicola/5980bd920ea73fe8c574c406a96b6915 to your computer and use it in GitHub Desktop.
Springboot CORS configurer
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class CorsConfigurers {
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").allowedOrigins("*");
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment