Skip to content

Commit

Permalink
,,
Browse files Browse the repository at this point in the history
  • Loading branch information
djdongjae committed Aug 6, 2024
1 parent 57d02c5 commit edc1057
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions src/main/java/net/skhu/tastyinventory_be/config/MvcConfigurer.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
package net.skhu.tastyinventory_be.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MvcConfigurer implements WebMvcConfigurer {
@Value("${client.origins}")
private String[] allowedOrigins;

@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins(allowedOrigins)
.allowedMethods(
HttpMethod.GET.name(),
HttpMethod.HEAD.name(),
HttpMethod.POST.name(),
HttpMethod.PUT.name(),
HttpMethod.DELETE.name())
.maxAge(3600)
.allowCredentials(true);
}
}
//package net.skhu.tastyinventory_be.config;
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.http.HttpMethod;
//import org.springframework.web.servlet.config.annotation.CorsRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
//@Configuration
//public class MvcConfigurer implements WebMvcConfigurer {
// @Value("${client.origins}")
// private String[] allowedOrigins;
//
// @Override
// public void addCorsMappings(CorsRegistry registry) {
// registry.addMapping("/**")
// .allowedOrigins(allowedOrigins)
// .allowedMethods(
// HttpMethod.GET.name(),
// HttpMethod.HEAD.name(),
// HttpMethod.POST.name(),
// HttpMethod.PUT.name(),
// HttpMethod.DELETE.name())
// .maxAge(3600)
// .allowCredentials(true);
// }
//}

0 comments on commit edc1057

Please sign in to comment.