本文主要是介绍mybatis generator自带的commentGenerator如何配置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
我看着MyBatis Generator生成的mapper真是烦,好多注释,然后查了一下很多兄弟也有同感。
有些兄弟发文说可以动手写个commentGenerator,就可以不生成注释了。
我觉得挺好的,但是要写代码,还要调试,就有点麻烦。
然后查了一下官网,原来MyBatis Generator自带的commentGenerator也可以配置。
https://mybatis.org/generator/configreference/commentGenerator.html
具体如下:
<commentGenerator type="org.mybatis.generator.internal.DefaultCommentGenerator"><!-- 是否去除自动生成的注释 true:是 : false:否 --><property name="suppressAllComments" value="true"/><property name="suppressDate" value="false"/><!-- 是否添加数据表中字段的注释 true:是 : false:否 --><property name="addRemarkComments" value="true"/>
</commentGenerator>
把上面这段加入generatorConfig文件中,再执行一下
mvn mybatis-generator:generate
生成的类对象就干干净净啦。
大家可以试一下。
这篇关于mybatis generator自带的commentGenerator如何配置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!