【发布时间】:2014-12-02 16:14:48
【问题描述】:
有些实体具有复合主键,这些实体在暴露时具有不正确的链接,在 _links 内的 URL 中具有类的完整限定名称
点击链接也会出现此类错误 -
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type com.core.connection.domains.UserFriendshipId
我有 XML 配置的 Spring Repository 并启用了 jpa:repositories 并且 Respository 从 JpaRepository 扩展
我可以让 Repository 实现 org.springframework.core.convert.converter.Converter 来处理这个问题。目前正在获取如下链接-
_links: {
userByFriendshipId: {
href: "http://localhost:8080/api/userFriendships/com.core.connection.domains.UserFriendshipId@5b10/userByFriendId"
}
在 xml 配置中,我启用了 jpa:repositories 并在 Repositories 中启用了 @RestResource
【问题讨论】:
-
我认为这里的解决方案将继承 RepositoryRestMvcConfiguration 并覆盖 configureConversionService。
标签: java spring spring-data spring-data-rest