创建名称为 'flyway' 的 bean 在 ServletContext 资源 [/WEB-INF/applicationContext-db.xml] 中定义时出错
Error creating bean with name 'flyway' defined in ServletContext resource [/WEB-INF/applicationContext-db.xml]
大家好,我从 flyway 中删除了 4 个 sql 文件,并从数据库中删除了相应的模式版本行,这是一个 spring mvc 项目。我试图回滚所有文件,但没有任何改变。我正在使用智能。有什么办法可以解决这个问题吗?
Error creating bean with name 'flyway' defined in ServletContext resource [/WEB-INF/applicationContext-db.xml]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Validate failed: Detected resolved migration not aenter code herepplied to database: 0.1.10
2020-12-17 22:21:21,189 INFO HikariPool - springHikariCP - Close initiated...
2020-12-17 22:21:21,205 INFO HikariPool - springHikariCP - Closed.
2020-12-17 22:21:21,205 ERROR ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flyway' defined in ServletContext resource [/WEB-INF/applicationContext-db.xml]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Validate failed: Detected resolved migration not applied to database: 0.1.10
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:296)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1076)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:851)
错误意味着 Flyway 可以看到一个不是最新的迁移文件 (V0.1.10) - 也就是说,历史记录中有更高编号的迁移 table - 但没有记录在过去应用它并且它没有被明确地忽略。快速解决方法是添加配置标志 -ignoreIgnoredMigrations=true
但原则上,您不应删除迁移文件并更改历史记录table。一旦你这样做了,如果你在任何地方引入不匹配,就有可能出错,而且你也打破了脚本集合(源代码控制,希望如此!)允许你忠实地重现数据库状态的想法flyway clean migrate
.
大家好,我从 flyway 中删除了 4 个 sql 文件,并从数据库中删除了相应的模式版本行,这是一个 spring mvc 项目。我试图回滚所有文件,但没有任何改变。我正在使用智能。有什么办法可以解决这个问题吗?
Error creating bean with name 'flyway' defined in ServletContext resource [/WEB-INF/applicationContext-db.xml]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Validate failed: Detected resolved migration not aenter code herepplied to database: 0.1.10
2020-12-17 22:21:21,189 INFO HikariPool - springHikariCP - Close initiated...
2020-12-17 22:21:21,205 INFO HikariPool - springHikariCP - Closed.
2020-12-17 22:21:21,205 ERROR ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flyway' defined in ServletContext resource [/WEB-INF/applicationContext-db.xml]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Validate failed: Detected resolved migration not applied to database: 0.1.10
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:296)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1076)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:851)
错误意味着 Flyway 可以看到一个不是最新的迁移文件 (V0.1.10) - 也就是说,历史记录中有更高编号的迁移 table - 但没有记录在过去应用它并且它没有被明确地忽略。快速解决方法是添加配置标志 -ignoreIgnoredMigrations=true
但原则上,您不应删除迁移文件并更改历史记录table。一旦你这样做了,如果你在任何地方引入不匹配,就有可能出错,而且你也打破了脚本集合(源代码控制,希望如此!)允许你忠实地重现数据库状态的想法flyway clean migrate
.