Answers for "Spring boot fix cors problem"

1

CORS with Spring Boot

@CrossOrigin
Posted by: Guest on April-26-2021
0

Spring boot fix cors problem

@Configuration
public class CorsConfig {

    @Bean
    public WebMvcConfigurer corsConfigurer() {
        return new WebMvcConfigurerAdapter() {
            @Override
            public void addCorsMappings(CorsRegistry registry) {
                registry.addMapping("/**").allowedMethods("GET", "POST", "PUT", "DELETE").allowedOrigins("*")
                        .allowedHeaders("*");
            }
        };
    }
}
Posted by: Guest on October-04-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language