rest - Kotlin +spring boot post请求默认布尔值
问题描述
目前我正在使用 Kotlin 开发 Spring Boot Restful Web 应用程序。我想在 post 请求的正文中添加一个布尔标志,如果未传入,则其默认值为 true
DTO:
data class PersonDTO(
@field:NotNull
val name: String,
val enabledProfile: Boolean = true // setting this to true is not working
)
默认情况下如何将标志设置enabledProfile
为true?
解决方案
推荐阅读
- c - 如何从 Gstreamer 管道中逐帧获取视频流?(没有 OpenCV)
- sqlite - 如何为 SQLite 的 PRAGMA application_id 选择一个幻数
- javascript - 带有关闭按钮的弹出式渲染,但单击时不起作用?
- c# - Access数据库插入不成功
- scala - 使用流式 ServiceCall 的 Lagom 服务之间的背压不起作用
- php - 从页面打开几个 javascript 链接
- matlab - 配对和迭代来自两个 CSV 文件的值
- html - 电子邮件地址链接在 HTML/VBA 中不起作用
- java - 我创建了一个页面对象模型,但我的登录页面为空。我该如何解决?
- php - 在 fpdf php 中创建一个双柱形图