1@Override
2 public void configure(HttpSecurity http) throws Exception {
3 http.cors().configurationSource(request -> new CorsConfiguration().applyPermitDefaultValues())
4 // ...
5 }
6
7
8 @Bean
9 public WebMvcConfigurer corsConfigurer() {
10 return new WebMvcConfigurer() {
11 @Override
12 public void addCorsMappings(CorsRegistry registry) {
13 registry.addMapping("/**")
14 .allowedOrigins("*")
15 .allowedMethods("GET", "PUT", "POST", "PATCH", "DELETE", "OPTIONS");
16 }
17 };
18 }