diff --git a/bonus-gateway/src/main/java/com/bonus/gateway/config/GlobalCorsConfig.java b/bonus-gateway/src/main/java/com/bonus/gateway/config/GlobalCorsConfig.java index 31cc812..a79daaa 100644 --- a/bonus-gateway/src/main/java/com/bonus/gateway/config/GlobalCorsConfig.java +++ b/bonus-gateway/src/main/java/com/bonus/gateway/config/GlobalCorsConfig.java @@ -1,7 +1,9 @@ package com.bonus.gateway.config; import cn.hutool.core.collection.CollUtil; +import com.alibaba.nacos.common.utils.JacksonUtils; import com.bonus.gateway.config.properties.CorsProperties; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -14,6 +16,7 @@ import org.springframework.web.util.pattern.PathPatternParser; * Description: 全局跨域配置 */ @Configuration +@Slf4j public class GlobalCorsConfig { @Autowired private CorsProperties corsProperties; @@ -24,6 +27,7 @@ public class GlobalCorsConfig { // 允许所有的HTTP请求方法(GET, POST, PUT, DELETE等) config.addAllowedMethod("*"); // 允许所有的域名发起的请求 比如http://localhost:8080、 + log.info("允许的域名:{}", corsProperties.getAllowedOrigins()); if(CollUtil.isNotEmpty(corsProperties.getAllowedOrigins())) { for(String cors : corsProperties.getAllowedOrigins()) { config.addAllowedOrigin(cors);