小编Ela*_*las的帖子

Spring Boot没有使用Jackson Kotlin插件

我不能强迫Spring为Jackson使用Kotlin模块.问题是Jackson无法将JSON解析为数据类.

//Exception
2018-02-23 13:29:09.046 ERROR 24730 --- [nio-9300-exec-1] o.a.c.c.C.[.[.[.[dispatcherServlet]      : Servlet.service() for servlet [dispatcherServlet] in context with path [/services] threw exception [Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [*.model.User]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: Parameter specified as non-null is null: method *.model.User.<init>, parameter name] with root cause
java.lang.IllegalArgumentException: Parameter specified as non-null is null: method *.User.<init>, parameter name

//JSON
{
    "name": "name",
    "surname": "surname",
    "email": "email",
    "password": "pswd"
}

//Model
@Entity
@Table
data class User( …
Run Code Online (Sandbox Code Playgroud)

spring jackson kotlin spring-boot

5
推荐指数
1
解决办法
786
查看次数

标签 统计

jackson ×1

kotlin ×1

spring ×1

spring-boot ×1