第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何在屬性文件中使用地圖

如何在屬性文件中使用地圖

精慕HU 2024-01-25 15:19:31
如何在屬性文件中映射它?我正在嘗試遵循Spring Cloud Gateway 上的此文檔然而,我們使用application.properties。spring:  cloud:    gateway:      globalcors:        corsConfigurations:          '[/**]':            allowedOrigins: "https://docs.spring.io"            allowedMethods:            - GET我嘗試了不同的變體但無濟(jì)于事:spring.cloud.gateway.globalcors.cors-configurations./**.allowed-originspring.cloud.gateway.globalcors.cors-configurations.[/**].allowed-origin我得到一個(gè)例外:************************** 應(yīng)用程序無法啟動(dòng)描述:無法將“spring.cloud.gateway.globalcors.cors-configurations.allowed-origins”下的屬性綁定到org.springframework.web.cors.CorsConfiguration:Reason: No converter found capable of converting from type [java.lang.String] to type[org.springframework.web.cors.CorsConfiguration]行動(dòng):更新您的應(yīng)用程序的配置請(qǐng)注意,此代碼使用 Spring Cloud Hoxton.M3。我理解,人們可能會(huì)認(rèn)為 Spring 指南中的已知實(shí)現(xiàn)可能就是答案,但事實(shí)并非如此,因?yàn)?SC Gateway 不再使用 HttpServlet。更新:根據(jù)馬科斯·巴貝羅的說法,這有效。顯然,Eclipse 無法將此數(shù)據(jù)類型理解為屬性?,F(xiàn)在,您必須忽略解析錯(cuò)誤。spring.cloud.gateway.globalcors.corsConfigurations.[/**].allowedOrigins=*spring.cloud.gateway.globalcors.corsConfigurations.[/**].allowedMethods=*spring.cloud.gateway.globalcors.corsConfigurations.[/**].allowCredentials=true
查看完整描述

2 回答

?
喵喔喔

TA貢獻(xiàn)1735條經(jīng)驗(yàn) 獲得超5個(gè)贊

我沒有嘗試過,但我認(rèn)為你可以這樣使用它:

spring.cloud.gateway.globalcors.corsConfigurations.[/**].allowedOrigins="https://docs.spring.io"
spring.cloud.gateway.globalcors.corsConfigurations.[/**].allowedMethods[0]=GET

如果不起作用,請(qǐng)嘗試刪除[/**]結(jié)果中的方括號(hào)/**


查看完整回答
反對(duì) 回復(fù) 2024-01-25
?
catspeake

TA貢獻(xiàn)1111條經(jīng)驗(yàn) 獲得超0個(gè)贊

您無法使用屬性文件設(shè)置這些屬性。而是使用 Spring 配置來設(shè)置這些屬性,如下所示:


@Bean

? ? public WebMvcConfigurer corsConfigurer() {

? ? ? ? return new WebMvcConfigurerAdapter() {

? ? ? ? ? ? @Override

? ? ? ? ? ? public void addCorsMappings(CorsRegistry registry) {

? ? ? ? ? ? ? ? registry.addMapping("/test-javaconfig").allowedOrigins("http://localhost:9000");

? ? ? ? ? ? }

? ? ? ? };

? ? }


查看完整回答
反對(duì) 回復(fù) 2024-01-25
  • 2 回答
  • 0 關(guān)注
  • 175 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)