Sonar static code analysis tells me this is a code smell and should be converted to a lamdba.
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("*");
}
};
}
I've tried various approaches with no luck. Any help is appreciated.
Assuming WebMvcConfigurer
is a functional interface, the method can be changed to the following:
public WebMvcConfigurer corsConfigurer() {
return registry -> registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("*");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With