内容简介:spring 初始化SQL脚本
@Bean @Profile({ "dev", "test", "prod" }) public InitializingBean sqlScriptInitAll() { List<ClassPathResource> scriptList = null; // 创建存储过程 try { scriptList = new ArrayList<>(); sanfSqlFile(scriptList); } catch (Exception e) { e.printStackTrace(); } if (vnelDataInit != null && vnelDataInit.booleanValue()) { return dataSourceInitializer(scriptList); } return null; } // -------------------------------------------------------------------------------- private DataSourceInitializer dataSourceInitializer(List<ClassPathResource> scriptList) { if (scriptList.size() <= 0) { return null; } ClassPathResource[] resArray = new ClassPathResource[scriptList.size()]; resArray = scriptList.toArray(resArray); ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator(true, true, "utf-8", resArray); DataSourceInitializer initializer = new DataSourceInitializer(); initializer.setDataSource(dataSource); initializer.setDatabasePopulator(databasePopulator); initializer.setEnabled(true); LOGGER.info("初始化 SQL 成功!"); return initializer; }
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- Python中用Ctrl+C终止threading初始化的多线程脚本
- C++ 的一大误区——深入解释直接初始化与复制初始化的区别
- 初始化监听端口
- 类初始化导致死锁
- nodejs源码—初始化
- golang 初始化顺序
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
The Starfish and the Spider
Ori Brafman、Rod A. Beckstrom / Portfolio Hardcover / 2006-10-05 / USD 24.95
Understanding the amazing force that links some of today's most successful companies If you cut off a spider's leg, it's crippled; if you cut off its head, it dies. But if you cut off a st......一起来看看 《The Starfish and the Spider》 这本书的介绍吧!