Spring boot + MyBatis返回map中null值默认不显示,如要调整为null值显示
需要在配置文件中添加属性,如下图红框中所示:
spring:
datasource:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=gktj
username: sa
password: 123
mybatis:
mapper-locations: classpath:mapper/*Mapper.xml
type-aliases-package: com.example.demo.bean
configuration:
call-setters-on-nulls: true
本文详细介绍了如何在SpringBoot结合MyBatis的项目中配置以显示数据库查询结果中的null值,通过调整mybatis配置项call-setters-on-nulls为true实现这一需求。
1万+

被折叠的 条评论
为什么被折叠?



