MyBatis代码生成器MBG

添加generatorConfig.xml文件




    
        
        
        
            
            
        

        
        
        
            
        

        

        

        
        

Generator.java 运行文件

public class Generator {
    public static void main(String[] args) throws IOException, XMLParserException, InvalidConfigurationException, SQLException, InterruptedException {
        List warnings = new ArrayList();

        boolean overwrite = true;

        InputStream is = Generator.class.getResourceAsStream("/generator/generatorConfig.xml");
        ConfigurationParser cp = new ConfigurationParser(warnings);
        Configuration config = cp.parseConfiguration(is);
        is.close();

        DefaultShellCallback callback = new DefaultShellCallback(overwrite);

        MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);

        myBatisGenerator.generate(null);

        for (String w : warnings) {
            System.out.println(w);
        }
    }
}

你可能感兴趣的:(MyBatis代码生成器MBG)