将liquibase升级到3.2.2后,单元测试打印异常

时间:2014-10-25 17:06:49

标签: spring-boot liquibase

我有一个spring boot / liquibase应用程序,在将liquibase升级到3.2.2后,单元测试开始打印此异常,但测试仍然通过:


[WARN] liquibase - Error initializing SpringLiquibase
java.io.FileNotFoundException: ServletContext resource [/] cannot be resolved to URL because it does not exist
    at org.springframework.web.context.support.ServletContextResource.getURL(ServletContextResource.java:156) ~[spring-web-4.0.7.RELEASE.jar:4.0.7.RELEASE]
    at liquibase.integration.spring.SpringLiquibase$SpringResourceOpener.init(SpringLiquibase.java:74) [liquibase-core-3.2.2.jar:na]
    at liquibase.resource.AbstractResourceAccessor.(AbstractResourceAccessor.java:19) [liquibase-core-3.2.2.jar:na]
    at liquibase.integration.spring.SpringLiquibase$SpringResourceOpener.(SpringLiquibase.java:64) [liquibase-core-3.2.2.jar:na]
    at liquibase.integration.spring.SpringLiquibase.createResourceOpener(SpringLiquibase.java:388) [liquibase-core-3.2.2.jar:na]
    at liquibase.integration.spring.SpringLiquibase.createLiquibase(SpringLiquibase.java:349) [liquibase-core-3.2.2.jar:na]
    at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:300) [liquibase-core-3.2.2.jar:na]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613) [spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550) [spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
    at ...

1 个答案:

答案 0 :(得分:4)

Spring Boot目前不支持Liquibase 3.2.2。我没有看到你在问题中发布的确切错误,但我怀疑这是Liquibase 3.0.x和3.2.x之间不兼容的另一个症状。

为了安全起见,你现在应该坚持使用Liquibase 3.0.x,虽然我相信3.1.x可能也可以。

有一个开放的Spring Boot issue描述了3.2.x的一些问题。还有一个开放的Spring Boot pull request,提供与Liquibase 3.2.x的兼容性。它计划包含在Spring Boot 1.2中,该版本将于Novemeber发布。