【发布时间】:2015-09-29 12:59:11
【问题描述】:
我有一个代表人工制品的对象:
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 来执行此操作?
【问题讨论】: