use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project Saturn by vipshop.
the class ServerCustomization method startEmbeddedDb.
public static void startEmbeddedDb() throws SQLException {
EmbeddedDatabaseBuilder embeddedDatabaseBuilder = new EmbeddedDatabaseBuilder();
embeddedDatabaseBuilder.setType(EmbeddedDatabaseType.H2).addScript("classpath:db/h2/global.sql").addScript("classpath:db/h2/schema.sql").addScript("classpath:db/h2/data.sql");
String customSql = "classpath:db/h2/custom.sql";
Resource resource = new DefaultResourceLoader().getResource(customSql);
if (resource.exists()) {
embeddedDatabaseBuilder.addScript(customSql);
}
embeddedDatabase = embeddedDatabaseBuilder.build();
System.setProperty("db.profiles.active", "h2");
}
use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project SpringStepByStep by JavaProgrammerLB.
the class DatabaseConfig method dataSource.
@Bean
public DataSource dataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.HSQL).build();
return db;
}
use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project SpringStepByStep by JavaProgrammerLB.
the class DatabaseConfig method dataSource.
@Bean
public DataSource dataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.HSQL).addScript("sql/create-db.sql").addScript("sql/insert-data.sql").build();
return db;
}
use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project tutorials by eugenp.
the class PersistenceConfig method dataSource.
@Bean
public DataSource dataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.H2).addScript("mySchema.sql").addScript("myData.sql").build();
return db;
}
use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project tutorials by eugenp.
the class PersistenceConfig method dataSource.
@Bean
public DataSource dataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.HSQL).addScript("db/sql/data.sql").build();
return db;
}
Aggregations