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 org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

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;
    }

    @Bean
    public WebMvcConfigurer corsConfigurer() {
        return new WebMvcConfigurerAdapter() {
            @Override
            public void addCorsMappings(CorsRegistry registry) {
                // we have to enable CORS to make requests from other domains work
                registry.addMapping("/**").allowedOrigins("*").allowedMethods("*");
            }
        };
    }
}

@@ -454,236 +454,8 @@
 rce;
-%0Aimport org.springframework.web.servlet.config.annotation.CorsRegistry;%0Aimport org.springframework.web.servlet.config.annotation.WebMvcConfigurer;%0Aimport org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
 %0A%0Aim
@@ -1198,397 +1198,7 @@
    %7D
-%0A%0A    @Bean%0A    public WebMvcConfigurer corsConfigurer() %7B%0A        return new WebMvcConfigurerAdapter() %7B%0A            @Override%0A            public void addCorsMappings(CorsRegistry registry) %7B%0A                // we have to enable CORS to make requests from other domains work%0A                registry.addMapping(%22/**%22).allowedOrigins(%22*%22).allowedMethods(%22*%22);%0A            %7D%0A        %7D;%0A    %7D
 %0A%7D%0A

remove duplicate configuration