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

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如果使用 spring-data-rest,找不到能夠從類型 [java.lang.String]

如果使用 spring-data-rest,找不到能夠從類型 [java.lang.String]

一只甜甜圈 2023-06-08 17:12:36
我在 spring-data-gcp-datastore 之上使用 spring-data-rest。我正在嘗試使用 HAL 瀏覽器探索我的資源。最初它工作正常,所以我看到了我的元素:{  "_embedded": {    "configurations": [      {        "data": "{\n  \"test\": \"768\",\n  \"test2\": 5\n}",        "_links": {          "self": {            "href": "http://localhost:8083/configurations/Key%7BprojectId=test,%20namespace=,%20path=%5BPathElement%7Bkind=configuration,%20id=null,%20name=k%7D%5D%7D"          },          "configuration": {            "href": "http://localhost:8083/configurations/Key%7BprojectId=test,%20namespace=,%20path=%5BPathElement%7Bkind=configuration,%20id=null,%20name=k%7D%5D%7D"          }        }      }    ]  },  "_links": {    "self": {      "href": "http://localhost:8083/configurations{?page,size,sort}",      "templated": true    },    "profile": {      "href": "http://localhost:8083/profile/configurations"    }  },  "page": {    "size": 20,    "totalElements": 1,    "totalPages": 1,    "number": 0  }}但是當(dāng)我嘗試通過提供的鏈接獲取一個特定資源時,http://localhost:8083/configurations/Key%7BprojectId=test,%20namespace=,%20path=%5BPathElement%7Bkind=configuration,%20id=null,%20name=k%7D%5D%7D我遇到了一個錯誤: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [com.google.cloud.datastore.Key]我試圖創(chuàng)建轉(zhuǎn)換器并通過這種方式注冊它們:@Componentpublic class WebConfig implements WebMvcConfigurer  {    @Override    public void addFormatters(FormatterRegistry registry) {        System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^");        registry.addConverter(new KeyToStringConverter());        registry.addConverter(new StringToKeyConverter());    }}我看到了打印輸出,所以代碼已經(jīng)執(zhí)行,盡管我在轉(zhuǎn)換器內(nèi)部的打印輸出沒有。我有簡單的實(shí)體:package com.test.appconfig.datastore.entities;import lombok.Data;import com.google.cloud.datastore.Key;import org.springframework.cloud.gcp.data.datastore.core.mapping.Entity;import org.springframework.data.annotation.Id;這些錯過的轉(zhuǎn)換器是什么?我該如何注冊它們?
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關(guān)注
  • 143 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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