MyBatis Plus Generator generates Entity


When using the MyBatis database persistence layer framework, we often use MyBatis Plus and its code generator to simplify development and improve efficiency.

When generating an Entity, the policy configuration of the code generator provides a lombok attribute, which can specify whether to use the lombok mode. This corresponds to the generation method of the attribute accessor. Because lombok is highly intrusive to code and relies on IDE plug-ins, when you are unwilling to use lombok, you can simply set the attribute to close: StrategyConfig. setEntityLombokModel (false);

L StrategyConfig turns off lombok mode by default

L The code generator example provided by MyBatis Plus opens lombok mode

MyBatis Plus Generator generates entity



@EqualsAndHashCode(callSuper = true)

@Accessors(chain = true)

public class Log extends BaseEntity {

private static final long serialVersionUID = 1L;

private Integer ops;

private String summary;


If l is set to false or this line of code is deleted, the generated Entity will generate a get/set function

public class Auth extends BaseEntity {

private static final long serialVersionUID = 1L;

private String name;

public String getName() {

return name;


public void setName(String name) {

this. name = name;



Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us

high perspicacity