package consulting.cochez.accounting;

import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class Accounting {
    @Bean
    public Jdk8Module javaOptionalModule() {
        return new Jdk8Module();
    }

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

@@ -238,169 +238,1906 @@
 ork.
-context.annotation.Bean;%0A%0A@SpringBootApplication%0Apublic class Accounting %7B%0A    @Bean%0A    public Jdk8Module javaOptionalModule() %7B%0A        return new Jdk8Module()
+boot.context.embedded.FilterRegistrationBean;%0Aimport org.springframework.context.annotation.Bean;%0Aimport org.springframework.web.cors.CorsConfiguration;%0Aimport org.springframework.web.cors.UrlBasedCorsConfigurationSource;%0Aimport org.springframework.web.filter.CorsFilter;%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%0A@SpringBootApplication%0Apublic class Accounting %7B%0A    @Bean%0A    public Jdk8Module javaOptionalModule() %7B%0A        return new Jdk8Module();%0A    %7D%0A%0A    @Bean%0A    public WebMvcConfigurer corsConfigurer() %7B%0A        return new WebMvcConfigurerAdapter() %7B%0A            @Override%0A            public void addCorsMappings(CorsRegistry registry) %7B%0A                registry.addMapping(%22/**%22);%0A            %7D%0A        %7D;%0A    %7D%0A%0A    /**%0A     * http://stackoverflow.com/a/31748398/122441 until https://jira.spring.io/browse/DATAREST-573%0A     * @return%0A     */%0A    @Bean%0A    public FilterRegistrationBean corsFilter() %7B%0A        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();%0A        CorsConfiguration config = new CorsConfiguration();%0A        config.setAllowCredentials(true);%0A        config.addAllowedOrigin(%22*%22);%0A        config.addAllowedHeader(%22*%22);%0A        config.addAllowedMethod(%22OPTIONS%22);%0A        config.addAllowedMethod(%22HEAD%22);%0A        config.addAllowedMethod(%22GET%22);%0A        config.addAllowedMethod(%22PUT%22);%0A        config.addAllowedMethod(%22POST%22);%0A        config.addAllowedMethod(%22DELETE%22);%0A        config.addAllowedMethod(%22PATCH%22);%0A        source.registerCorsConfiguration(%22/**%22, config);%0A        // return new CorsFilter(source);%0A        final FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source));%0A        bean.setOrder(0);%0A        return bean
 ;%0A  

enable cors