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

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

通過嘗試從 Googl-Cloud-Storage 讀取值來獲得無效授權(quán)

通過嘗試從 Googl-Cloud-Storage 讀取值來獲得無效授權(quán)

浮云間 2023-06-14 16:33:21
我試圖從我的 Spring 應(yīng)用程序中讀取 Google-Cloud 存儲(chǔ)中的值。我使用 Spring Cloud GCP 擴(kuò)展來處理 Google Cloud Storage。我的 gcp 依賴項(xiàng)的 Pom.xml:<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-gcp-starter-storage</artifactId>  <version>1.1.2.RELEASE</version></dependency>當(dāng)我嘗試從我的休息端點(diǎn)讀取文件時(shí),我得到異常(在我的回答結(jié)束時(shí))不知何故我的令牌無法刷新?我在哪里可以設(shè)置我的 clientId 或者還有其他事情發(fā)生?我使用了 pivotal 和 google 提供的示例應(yīng)用程序中的代碼。@RestControllerpublic class GCloudStorageController {    @Value("gs://test_files_test/test.txt")    private Resource gcsFile;    @RequestMapping(value = "/cloud", method = RequestMethod.GET)    public String readGcsFile() throws IOException {        return StreamUtils.copyToString(                this.gcsFile.getInputStream(),                Charset.defaultCharset()) + "\n";    }    @RequestMapping(value = "/cloud", method = RequestMethod.POST)    String writeGcs(@RequestBody String data) throws IOException {        try (OutputStream os = ((WritableResource) this.gcsFile).getOutputStream()) {            os.write(data.getBytes());        }        return "file was updated\n";    }}
查看完整描述

2 回答

?
弒天下

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

這看起來像是關(guān)于身份驗(yàn)證的問題。您是否遵循了通用的“Spring Cloud GCP Core”[1] 配置?

檢查您的 application.properties [2](或其他配置)并確保它至少包含以下屬性:

spring.cloud.gcp.datastore.project-id=XXX
spring.cloud.gcp.datastore.credentials.location=YYY

或選擇 [1] 中顯示的其他方法。

[1] https://cloud.spring.io/spring-cloud-static/spring-cloud-gcp/1.1.2.RELEASE/single/spring-cloud-gcp.html#spring-cloud-gcp-core

[2] https://github.com/spring-cloud/spring-cloud-gcp/blob/master/spring-cloud-gcp-samples/spring-cloud-gcp-data-datastore-sample/src/main/resources/application.properties


查看完整回答
反對(duì) 回復(fù) 2023-06-14
?
互換的青春

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

教程中從未提及實(shí)施“Spring Cloud GCP Core”的資源,或者我忽略了它。

我的控制臺(tái)上的 Google Cloud SDK 以某種方式連接了另一個(gè)帳戶。所以我用

gcloud auth application-default login

并登錄正確的帳戶?,F(xiàn)在可以了。謝謝。


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

添加回答

舉報(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)