mybatisGenerator的配置文件生成代码

@Testpublic void test11(){

ArrayList warings = new ArrayList();

boolean overwrite=true;

String getConfig="/generatorConfig.xml";

File file = new File(test1.class.getResource(getConfig).getFile());

ConfigurationParser configurationParser = new ConfigurationParser(warings);

Configuration configuration=null;

try {

configuration = configurationParser.parseConfiguration(file);

} catch (IOException e) {

e.printStackTrace();

} catch (XMLParserException e) {

e.printStackTrace();

}

DefaultShellCallback defaultShellCallback = new DefaultShellCallback(overwrite);

MyBatisGenerator myBatisGenerator=null;

try {

myBatisGenerator = new MyBatisGenerator(configuration,defaultShellCallback,warings);

} catch (InvalidConfigurationException e) {

e.printStackTrace();

} try {

myBatisGenerator.generate(null);

} catch (SQLException e) {

e.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

} catch (InterruptedException e) {

e.printStackTrace();

}

}

你可能感兴趣的:(mybatisGenerator的配置文件生成代码)