RESOLVED - issue SPR-6365: spring-jdbc.xsd script element claims resource patterns can be used for any SQL resource location but this is only supported for initialize-database tag
Grr: classpath*: again...
This commit is contained in:
parent
7519162e65
commit
17887d24a1
|
|
@ -14,18 +14,24 @@ public class JdbcNamespaceIntegrationTest {
|
||||||
public void testCreateEmbeddedDatabase() throws Exception {
|
public void testCreateEmbeddedDatabase() throws Exception {
|
||||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||||
"org/springframework/jdbc/config/jdbc-config.xml");
|
"org/springframework/jdbc/config/jdbc-config.xml");
|
||||||
assertCorrectSetup(context.getBean("dataSource", DataSource.class));
|
try {
|
||||||
assertCorrectSetup(context.getBean("h2DataSource", DataSource.class));
|
assertCorrectSetup(context.getBean("dataSource", DataSource.class));
|
||||||
assertCorrectSetup(context.getBean("derbyDataSource", DataSource.class));
|
assertCorrectSetup(context.getBean("h2DataSource", DataSource.class));
|
||||||
context.close();
|
assertCorrectSetup(context.getBean("derbyDataSource", DataSource.class));
|
||||||
|
} finally {
|
||||||
|
context.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateWithResourcePattern() throws Exception {
|
public void testCreateWithResourcePattern() throws Exception {
|
||||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||||
"org/springframework/jdbc/config/jdbc-config-pattern.xml");
|
"org/springframework/jdbc/config/jdbc-config-pattern.xml");
|
||||||
assertCorrectSetup(context.getBean("dataSource", DataSource.class));
|
try {
|
||||||
context.close();
|
assertCorrectSetup(context.getBean("dataSource", DataSource.class));
|
||||||
|
} finally {
|
||||||
|
context.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertCorrectSetup(DataSource dataSource) {
|
private void assertCorrectSetup(DataSource dataSource) {
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd">
|
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd">
|
||||||
|
|
||||||
<jdbc:embedded-database id="dataSource">
|
<jdbc:embedded-database id="dataSource" type="HSQL">
|
||||||
<jdbc:script location="classpath:org/springframework/jdbc/config/db-schema.sql"/>
|
<jdbc:script location="classpath:org/springframework/jdbc/config/db-schema.sql"/>
|
||||||
<jdbc:script location="classpath:org/springframework/jdbc/config/*-data.sql"/>
|
<jdbc:script location="classpath*:org/springframework/jdbc/config/*-data.sql"/>
|
||||||
</jdbc:embedded-database>
|
</jdbc:embedded-database>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue