提交 17887d24 编写于 作者: D David Syer

RESOLVED - issue SPR-6365: spring-jdbc.xsd script element claims resource...

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...
上级 7519162e
......@@ -14,18 +14,24 @@ public class JdbcNamespaceIntegrationTest {
public void testCreateEmbeddedDatabase() throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"org/springframework/jdbc/config/jdbc-config.xml");
assertCorrectSetup(context.getBean("dataSource", DataSource.class));
assertCorrectSetup(context.getBean("h2DataSource", DataSource.class));
assertCorrectSetup(context.getBean("derbyDataSource", DataSource.class));
context.close();
try {
assertCorrectSetup(context.getBean("dataSource", DataSource.class));
assertCorrectSetup(context.getBean("h2DataSource", DataSource.class));
assertCorrectSetup(context.getBean("derbyDataSource", DataSource.class));
} finally {
context.close();
}
}
@Test
public void testCreateWithResourcePattern() throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"org/springframework/jdbc/config/jdbc-config-pattern.xml");
assertCorrectSetup(context.getBean("dataSource", DataSource.class));
context.close();
try {
assertCorrectSetup(context.getBean("dataSource", DataSource.class));
} finally {
context.close();
}
}
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
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/*-data.sql"/>
<jdbc:script location="classpath*:org/springframework/jdbc/config/*-data.sql"/>
</jdbc:embedded-database>
</beans>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册