Skip to content

Instantly share code, notes, and snippets.

@ruan65
Created February 8, 2018 09:35
Show Gist options
  • Save ruan65/8b84a46d086eeedc06c0a26483b0a4ed to your computer and use it in GitHub Desktop.
Save ruan65/8b84a46d086eeedc06c0a26483b0a4ed to your computer and use it in GitHub Desktop.
Controller method CORS configuration
// if localhost do not forget add http:// before url
package ru.redsys.event_manager_rea.configuration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
@EnableWebMvc
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment