使用spring data keyvalue示例时,代码如下:
private final HashMapper<Post, String, String> postMapper =
new DecoratingStringHashMapper<Post>(
new JacksonHashMapper<Post>(Post.class));
我使用kotlin在线工具,它转换为:
private val postMapper = DecoratingStringHashMapper<Post>(
JacksonHashMapper<Post>(Post::class.java))
但是想法告诉我:
错误:(28,5)Kotlin:类型不匹配:推断类型是 JacksonHashMapper但是HashMapper!预计
该怎么办?
答案 0 :(得分:0)
private val postMapper =
DecoratingStringHashMapper(Jackson2HashMapper(true))
希望得到它的帮助!