我有一个代表Artefact的对象:
public class Artifact {
private final URI location;
public Artifact(URI location) {
this.location = location;
}
}
当我使用MongoTemplate
保存时,URI会变成一个对象:
{ "location" : { "scheme" : "http", "authority" : "localhost:8080", "host" : "localhost", "port" : 8080, "path" : "/testFrontendURL", "schemeSpecificPart" : "//localhost:8080/testFrontendURL", "hash" : 331612143, "string" : "http://localhost:8080/testFrontendURL" }
但是,这可以用URI字符串表示:
{"location": "http://localhost:8080/testFrontendURL"}
如何配置Spring Data来执行此操作?