首页 > 编程知识 正文

springboot开启cors,get请求会跨域吗

时间:2023-05-04 10:16:21 阅读:159876 作者:4877

在全局拦截器里添加

getResponse ().setheader (' access-control-allow-origin ',' * ' );下方仅仅只是测试,我一般都是放在全局拦截器中。

@requestmapping(/student ) ) publicclassstudentcontrollerextendsjbootcontroller (public void add ) ) {getResponse stringage=getpara(age ); stringphone=getpara('phone ); rendertext(ok: ); }

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。