mybatis-generator使用

配置文件

【mybatis-generator使用】

代码
package com.dlq.blog.test; import org.mybatis.generator.api.MyBatisGenerator; import org.mybatis.generator.config.Configuration; import org.mybatis.generator.config.xml.ConfigurationParser; import org.mybatis.generator.internal.DefaultShellCallback; import java.io.File; import java.util.ArrayList; import java.util.List; /** * @author donglq * @date 2017/10/11 21:36 */ public class MybatisGenerator {public static void main(String[] args) { try { List warnings = new ArrayList(); boolean overwrite = true; File configFile = new File("src/test/resources/generatorConfig.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); } catch (Exception e) { e.printStackTrace(); } }}

jar包
mysql:mysql-connector-java:5.1.25 org.mybatis.generator:mybatis-generator-core:1.3.5

    推荐阅读