Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package config;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.web.servlet.config.annotation.CorsRegistry;
- import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
- import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
- /**
- * Configures CORS globally.
- */
- @Configuration
- public class WebConfig {
- @Bean
- public WebMvcConfigurer corsConfigurer() {
- return new WebMvcConfigurerAdapter() {
- @Override
- public void addCorsMappings(CorsRegistry registry) {
- registry.addMapping("/**")
- // allow all methods, since only GET, POST, and HEAD are allowed by default
- .allowedMethods("*");
- }
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement