package com.codecrafters.server;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;

import java.util.Collections;

@SpringBootApplication
@EnableScheduling
public class SpringBootGwtApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringBootGwtApplication.class, args);
    }

    @Bean
    CorsConfigurationSource corsConfigurationSource() {
        final CorsConfiguration configuration = new CorsConfiguration();
        configuration.setAllowedOrigins(Collections.singletonList(CorsConfiguration.ALL));
        configuration.setAllowedMethods(Collections.singletonList(CorsConfiguration.ALL));

        final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
        source.registerCorsConfiguration("/**", configuration);
        return source;
    }
}

@@ -349,32 +349,40 @@
 mework.web.cors.
+UrlBased
 CorsConfiguratio
@@ -425,75 +425,25 @@
 web.
-cors.UrlBasedCorsConfigurationSource;%0A%0Aimport java.util.Collections
+filter.CorsFilter
 ;%0A%0A@
@@ -662,55 +662,36 @@
     
-CorsConfigurationSource corsConfigurationSource
+public CorsFilter corsFilter
 () %7B
@@ -729,23 +729,16 @@
 n config
-uration
  = new C
@@ -759,98 +759,34 @@
 on()
-;%0A        configuration.setAllowedOrigins(Collections.singletonList(CorsConfiguration.ALL)
+.applyPermitDefaultValues(
 );%0A 
@@ -802,19 +802,12 @@
 nfig
-uration.set
+.add
 Allo
@@ -819,58 +819,12 @@
 thod
-s(Collections.singletonList(CorsConfiguration.ALL)
+(%22*%22
 );%0A%0A
@@ -971,23 +971,16 @@
 , config
-uration
 );%0A     
@@ -989,22 +989,38 @@
  return 
+new CorsFilter(
 source
+)
 ;%0A    %7D%0A

fix cors