找回密码
 立即注册

8,解决跨域问题

[复制链接]
发表于 2026-2-16 18:32:54 | 显示全部楼层 |阅读模式
  1. package com.jinhei.ai.config;

  2. import org.springframework.context.annotation.Configuration;
  3. import org.springframework.web.servlet.config.annotation.CorsRegistry;
  4. import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

  5. @Configuration
  6. public class MvcConfiguration implements WebMvcConfigurer {

  7.     @Override
  8.     public void addCorsMappings(CorsRegistry registry) {
  9.         registry.addMapping("/**")
  10.                 .allowedOrigins("*")
  11.                 .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
  12.                 .allowedHeaders("*")
  13.                 .exposedHeaders("Content-Disposition");
  14.     }
  15. }
复制代码


网站建设,公众号小程序开发,系统定制,软件App开发,技术维护【联系我们】手机/微信:17817817816 QQ:515138

QQ|Archiver|自丢网 ( 粤ICP备2024252464号-1 )

GMT+8, 2026-11-4 19:44

专注于网站建设,公众号小程序制作,商城小程序,系统定制,软件App开发

【联系我们】手机/微信:17817817816 QQ:515138

快速回复 返回顶部 返回列表