Vue中前后端分离 出现跨域session不是同一个(跨域)

news/2024/7/6 6:41:10

后端:

package com.example.mybatisplustest.config;

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

@Configuration
public class Cors implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*")
                .allowedMethods("GET", "POST", "PUT", "OPTIONS", "DELETE", "PATCH")
                .allowedHeaders("*")
                .allowCredentials(true).maxAge(3600);
    }
}
package com.example.mybatisplustest.config;

import org.springframework.context.annotation.Configuration;

import javax.servlet.*;
import javax.servlet.an

http://www.niftyadmin.cn/n/3781838.html

相关文章

dutacm.club Water Problem(矩阵快速幂)

Water Problem Time Limit:3000/1000 MS (Java/Others) Memory Limit:163840/131072 KB (Java/Others)Total Submissions:1228 Accepted:121[Submit][Status][Discuss] Description 函数 f:Z→Z 。已知 f(1),f(2) 的值,且对于任意 x>1&#xff0c…

爱上MVC~ajax调用分部视图session超时页面跳转问题

回到目录 这个问题出现了很多年了,都没有解决,问题是这样的,有一个需要授权才可以访问的分部视图,在一个view中使用ajax的方法去调用它,然后更新页面的局部DIV,这时,如果你长时间不操作&#xf…

Java类加载器和双亲委派机制

前言 之前详细介绍了Java类的整个加载过程(类加载机制详解)。虽然,篇幅较长,但是也不要被内容吓到了,其实每个阶段都可以用一句话来概括。 1)加载:查找并加载类的二进制字节流数据。 2&#…

H3C常用命令详解

H3C常用命令详解 作者&#xff1a;尹正杰 版权声明&#xff1a;原创作品&#xff0c;谢绝转载&#xff01;否则将追究法律责任。 1.关闭后台日志输出 <yinzhengjie>sys [yinzhengjie]undo info-center enable 2.查看设备IOS版本信息&#xff0c;设备启动时间&#xff0c…

Centos7中mysql安装

一、安装YUM Repo 1、由于CentOS 的yum源中没有mysql&#xff0c;需要到mysql的官网下载yum repo配置文件。 下载命令&#xff1a; wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm 2、然后进行repo的安装&#xff1a; rpm -ivh mysql57-communi…

收集的网站

响应式设计&#xff1a; http://wf.uisdc.com/cn/ UI相关: http://www.uisdc.com/  优设 http://www.xueui.cn/ http://www.xueui.cn/design-theory/learn-ui-1.html  感觉UI也很有意思&#xff0c;慢慢学习 http://www.sketchcn.com/ http://www.cutterman.cn/zh   一款…

输入页 离开页面前弹出框

离开页面确认主要是利用了onbeforeunload事件&#xff0c;存 在着兼容问题 当该事件声明为 &#xff1a; Java代码 <body onbeforeunload "return pageBeforeunload(event);" > <script type "text/javascript" > function pageBeforeunl…

SpringBoot拦截器注入配置文件的配置参数为null的解决方案

在注册拦截器&#xff0c;即继承WebMvcConfigurerAdapter的类中&#xff0c;普通拦截器的注册方法为&#xff1a; Overridepublic void addInterceptors(InterceptorRegistry registry) {registry.addInterceptor(new LogInterceptor()).addPathPatterns("/**");supe…