解决mybatis返回map时value值为null没有对应的key
spring boot在配置文件中:
mybatis.configuration.call-setters-on-nulls=true
使用mybatis.xml 配置文件时,如下设置:
<configuration>
<settings>
<!-- 在null时也调用 setter,适应于返回Map,3.2版本以上可用 -->
<setting name="callSettersOnNulls" value="true"/>
</settings>
</configuration>
本文介绍如何在SpringBoot项目中通过配置mybatis.configuration.call-setters-on-nulls参数为true,来解决MyBatis在返回Map时value值为null导致的key缺失问题。适用于MyBatis 3.2版本及以上。
930

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



