@Test public void testInitialisationWorksAsExpected() { final RestCorsConfig restCorsConfig = new RestCorsConfig(); final CorsFilter corsFilter = restCorsConfig.corsFilter(); assertNotNull(corsFilter); }
@Bean public CorsFilter corsFilter() { LOG.info(() -> String.format("CORS Allowed Origins: %s", allowedOrigin)); final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); final CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); config.addAllowedOrigin(allowedOrigin); config.addAllowedHeader("*"); config.addAllowedMethod("OPTIONS"); config.addAllowedMethod("GET"); config.addAllowedMethod("POST"); config.addAllowedMethod("PUT"); config.addAllowedMethod("DELETE"); source.registerCorsConfiguration("/**", config); return new CorsFilter(source); }
RestCorsConfig { @Bean public CorsFilter corsFilter() { LOG.info(() -> String.format("CORS Allowed Origins: %s", allowedOrigin)); final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); final CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); config.addAllowedOrigin(allowedOrigin); config.addAllowedHeader("*"); config.addAllowedMethod("OPTIONS"); config.addAllowedMethod("GET"); config.addAllowedMethod("POST"); config.addAllowedMethod("PUT"); config.addAllowedMethod("DELETE"); source.registerCorsConfiguration("/**", config); return new CorsFilter(source); } }
RestCorsConfig { @Bean public CorsFilter corsFilter() { LOG.info(() -> String.format("CORS Allowed Origins: %s", allowedOrigin)); final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); final CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); config.addAllowedOrigin(allowedOrigin); config.addAllowedHeader("*"); config.addAllowedMethod("OPTIONS"); config.addAllowedMethod("GET"); config.addAllowedMethod("POST"); config.addAllowedMethod("PUT"); config.addAllowedMethod("DELETE"); source.registerCorsConfiguration("/**", config); return new CorsFilter(source); }  }
RestCorsConfig { @Bean public CorsFilter corsFilter() { LOG.info(() -> String.format("CORS Allowed Origins: %s", allowedOrigin)); final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); final CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); config.addAllowedOrigin(allowedOrigin); config.addAllowedHeader("*"); config.addAllowedMethod("OPTIONS"); config.addAllowedMethod("GET"); config.addAllowedMethod("POST"); config.addAllowedMethod("PUT"); config.addAllowedMethod("DELETE"); source.registerCorsConfiguration("/**", config); return new CorsFilter(source); }  @Bean CorsFilter corsFilter(); }
RestCorsConfig { @Bean public CorsFilter corsFilter() { LOG.info(() -> String.format("CORS Allowed Origins: %s", allowedOrigin)); final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); final CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); config.addAllowedOrigin(allowedOrigin); config.addAllowedHeader("*"); config.addAllowedMethod("OPTIONS"); config.addAllowedMethod("GET"); config.addAllowedMethod("POST"); config.addAllowedMethod("PUT"); config.addAllowedMethod("DELETE"); source.registerCorsConfiguration("/**", config); return new CorsFilter(source); }  @Bean CorsFilter corsFilter();  }