亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

@CrossOrigin(allowCredentials = "true",allowedHeaders = "*") 總是報錯

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: When allowCredentials is true, allowedOrigins cannot contain the special value "*" since that cannot be set on the "Access-Control-Allow-Origin" response header. To allow credentials to a set of origins, list them explicitly or consider using "allowedOriginPatterns" instead.

http://img1.sycdn.imooc.com//611a64b50001691b19110697.jpg

正在回答

1 回答

在最新的?2.5.2?版本中,使用這種方式運行項目會報錯,使用了 allowCredentials = “true” 之后,不可以把origin設置為*(即默認狀態)。

如果在IDEA里運行可以加上域名否則就用第二行的

@CrossOrigin(origins?=?"http://localhost:63342",allowCredentials?=?"true",allowedHeaders?=?"*")
@CrossOrigin(origins?=?{"?*?"},?allowedHeaders="*")
下載視頻 ? ? ? ? ?
0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

@CrossOrigin(allowCredentials = "true",allowedHeaders = "*") 總是報錯

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號