在使用mybatis自動生成mapper/dao/bean 文件時,爲了配置自動get/set和bean屬性註解, 需引入mybatis-generator-lombok-plugin 下載地址:https://github.com/GuoGuiRong/mybatis-generator-lombok-plugin
注意:此時直接在
<dependencies> <dependency> <groupId>com.chrm</groupId> <artifactId>mybatis-generator-lombok-plugin</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies>
時generate時報錯Cannot instantiate object of type com.chrm.mybatis.generator.plugins.CommentPlugin ,
需修改成在plugin裏引入 即可
<plugin>
<groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.5</version>
<configuration> <!-- generator 工具配置文件的位置 --> <configurationFile>src/main/resources/generatorConfig.xml</configurationFile> </configuration>
<dependencies> <dependency> <groupId>com.chrm</groupId> <artifactId>mybatis-generator-lombok-plugin</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies> </plugin>