直接在mybatis-config.xml文件中添加以下属性即可:
<configuration> <settings>
<setting name="callSettersOnNulls" value="true"/>
</settings>
</configuration>