我有一个spring boot / liquibase应用程序,将liquibase升级到3.2.2单元测试后开始打印此异常,但测试仍然通过:[WARN] liquibase - Error initializing SpringLiquibasejava.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 ...
最佳答案
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中发布。