MyBatis Generator removes the generated annotations

  • 2020-05-12 02:43:23
  • OfStack

Don't you hate the fact that mybatis Generator generates a bunch of comments in Mapper and mapper.xml files when they generate code for us? Today, when looking at the MyBatis Generator code, it turns out that mybatis generator provides the ability to configure annotations as follows. Add the configuration to generatorConfig.xml:


<commentGenerator>
<property name="suppressDate" value="true"/>
<property name="suppressAllComments" value="true" />
</commentGenerator>

Can;

Where suppressDate is to remove the generation date line comment, suppressAllComments is to remove all the comments;

In addition, commentGenerator can configure an type to set up its own annotation generator, which is used by default

org. mybatis. generator. internal. DefaultCommentGenerator;


Related articles: