1. 程式人生 > >mybatis 單側 生成 dao model mapper

mybatis 單側 生成 dao model mapper

1、mybatis 單側程式碼


    @Test
    public void gen() throws Exception {
        List<String> warnings = new ArrayList<String>();
        boolean overwrite = true;

        ClassPathResource resource = new ClassPathResource("generator.xml");
        InputStream is = resource.getInputStream();
        ConfigurationParser cp = new ConfigurationParser(warnings);
        Configuration config = cp.parseConfiguration(is);
        DefaultShellCallback callback = new DefaultShellCallback(overwrite);
        MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
        myBatisGenerator.generate(null);
    }