spring-guides / gs-rest-service-cors

Enabling Cross Origin Requests for a RESTful Web Service :: Learn how to create a RESTful web service with Spring that support Cross-Origin Resource Sharing (CORS).

Home Page:https://spring.io/guides/gs/rest-service-cors/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spring Guide recommends to use obsolete method

imanushin opened this issue · comments

See document https://spring.io/guides/gs/rest-service-cors/#_enabling_cors

Code below tries to use deprecated WebMvcConfigurerAdapter, instead of inline interface implementation:

    @Bean
    public WebMvcConfigurer corsConfigurer() {
        return new WebMvcConfigurerAdapter() {
            @Override
            public void addCorsMappings(CorsRegistry registry) {
                registry.addMapping("/greeting-javaconfig").allowedOrigins("http://localhost:9000");
            }
        };
    }

This should be fixed by #19

This should be fixed by #19

Not fixed after almost 1 year, the guide still uses the deprecated WebMvcConfigurerAdapter.

#19 was never merged. Maybe one of the maintainers could have a look?