Skip to content

配合JAVA后台,插件配置提交时报错Cannot construct instance of java.util.LinkedHashMap #146

@hotcoffie

Description

@hotcoffie

修改任意插件的json配置文件,保存,后台就会报错:

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `java.util.LinkedHashMap` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('{
    "MiniApp": {
        "appid": "xxxxx",
        "secret": "xxxxx"
    }
}')

原因是java后台中,接收参数config字段是

    @ColumnDefine(comment = "配置", type = "json")
    @Column(typeHandler = JacksonTypeHandler.class)
    private Map<String, Object> config;

而前端传递的config字段是json字符串
我自己的解决办法是在前端传递时:

{
    ...data,
    config:JSON.parse(data.config)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions