package com.moral.security;
|
|
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 WebMvcConfiguration extends WebMvcConfigurerAdapter {
|
|
@Override
|
public void addCorsMappings(CorsRegistry registry) {
|
registry.addMapping("/**").allowedOrigins("*")
|
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS")
|
.allowCredentials(false).maxAge(3600);
|
|
// registry.addMapping("/api/**")
|
// .allowedOrigins("http://192.168.1.97")
|
// .allowedMethods("GET", "POST")
|
// .allowCredentials(false).maxAge(3600);
|
}
|
}
|