SPR-8592: add SpEL support in <jdbc:/>
This commit is contained in:
@@ -91,6 +91,13 @@ public class InitializeDatabaseIntegrationTests {
|
||||
assertCorrectSetup(dataSource);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScriptNameWithExpressions() throws Exception {
|
||||
context = new ClassPathXmlApplicationContext("org/springframework/jdbc/config/jdbc-initialize-expression-config.xml");
|
||||
DataSource dataSource = context.getBean("dataSource", DataSource.class);
|
||||
assertCorrectSetup(dataSource);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCacheInitialization() throws Exception {
|
||||
context = new ClassPathXmlApplicationContext("org/springframework/jdbc/config/jdbc-initialize-cache-config.xml");
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="HSQL" />
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource" enabled="#{properties['data.source.init']}">
|
||||
<jdbc:script location="#{properties['schema.scripts']}" />
|
||||
<jdbc:script location="#{properties['insert.scripts']}" />
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<util:properties id="properties">
|
||||
<prop key="schema.scripts">classpath:org/springframework/jdbc/config/db-schema.sql</prop>
|
||||
<prop key="insert.scripts">classpath*:org/springframework/jdbc/config/*-data.sql</prop>
|
||||
<prop key="data.source.init">true</prop>
|
||||
</util:properties>
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user