generatorConfig.xml GeneratorMain.java package com.min;import org.mybatis.generator.api.MyBatisGenerator;import org.mybatis.generator.config.Configuration;import org.mybatis.generator.config.xml.ConfigurationParser;import org.mybatis.genera
GeneratorMain.java
package com.min; 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.util.ArrayList; import java.util.List; /** * * @author llx * @date 2017/11/30 * 参考 https://mapperhelper.github.io/docs */ public class GeneratorMain { public static void main(String[] args) { Listwarnings = new ArrayList (); boolean overwrite = true; ConfigurationParser cp = new ConfigurationParser(warnings); try { Configuration config = cp.parseConfiguration(GeneratorMain.class.getResourceAsStream("/generatorConfig.xml")); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); myBatisGenerator.generate(null); } catch (Exception e) { e.printStackTrace(); } } }