@Configuration
@RequiredArgsConstructor
public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
final List<String> httpMethods = Arrays.stream(HttpMethod.values())
.map(HttpMethod::name)
.collect(Collectors.toList());
String[] allowedMethods = new String[httpMethods.size()];
registry.addMapping("/**")
.allowedMethods(httpMethods.toArray(allowedMethods))
.allowedOrigins("*");
}
}
JW_FREE_NOTE