@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 &amp;&amp; vnelDataInit.booleanValue()) {
        return dataSourceInitializer(scriptList);
    }
    return null;
}

// --------------------------------------------------------------------------------
private DataSourceInitializer dataSourceInitializer(List&lt;ClassPathResource&gt; scriptList) {

    if (scriptList.size() &lt;= 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;
}</pre>