Skip to content Skip to sidebar Skip to footer

Cross Origin On Spring Boot From Chrome Extension

In my spring application, I have a method: @CrossOrigin(origins='*') @PostMapping('/datum') Datum test(@RequestBody String data) { return repository.save(new Datum(data)); } I

Solution 1:

In my @SpringBootApplication annoted class, I added this :

@BeanpublicWebMvcConfigurercorsConfigurer() {
        returnnewWebMvcConfigurer() {
            @OverridepublicvoidaddCorsMappings(CorsRegistry registry) {
                registry.addMapping("/**").allowedOrigins("*");
            }
        };
    }

And in manifest.json:

"permissions":["activeTab","tabs","background","http://*/"]

Now it works.

Post a Comment for "Cross Origin On Spring Boot From Chrome Extension"