Commit 79be31f8720043c008ea785cdd727ea908da3207

Authored by kangtian
1 parent 18051dc8

添加跨域配置

assistant-shared/src/main/java/com/diligrp/assistant/shared/authority/CorsConfig.java 0 → 100644
  1 +package com.diligrp.assistant.shared.authority;
  2 +
  3 +import org.springframework.context.annotation.Configuration;
  4 +import org.springframework.web.servlet.config.annotation.CorsRegistry;
  5 +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
  6 +
  7 +@Configuration
  8 +public class CorsConfig implements WebMvcConfigurer {
  9 +
  10 + @Override
  11 + public void addCorsMappings(CorsRegistry registry) {
  12 + registry.addMapping("/**")
  13 + .allowedOriginPatterns("*")
  14 + .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
  15 + .allowedHeaders("*")
  16 + .allowCredentials(true)
  17 + .maxAge(3600);
  18 + }
  19 +}
... ...