MyBatis Generator Core – Introduction to MyBatis Generatorhttp://mybatis.org/generator
2、generator作用作用:根据表帮你生成对应的实体类,dao接口和xml映射文件,即每张表基本的增删改查的数据库操作方法。
3、配置方式(1)导入完整的jar包依赖
org.mybatis.generator mybatis-generator-core1.4.0
(2)在工程的根目录下创建配置文件
(3)运行创建
@Test
public void aaa()throws Exception{
List warnings = new ArrayList();
boolean overwrite = true;
File configFile = new File("generator.xml");
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConfiguration(configFile);
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
myBatisGenerator.generate(null);
}
(4)创建完成后,其中会有很多的英文注释,如果不想要也是可以去掉的



