我的项目中有以下配置,但由于某种原因,从未执行过更改日志。
关于我所缺少的任何想法?
我可以成功使用 mongo 客户端并执行 CRUD 操作,只是 MongockStandalone 不起作用。
pom.xml
<dependency>
<groupId>com.github.cloudyrock.mongock</groupId>
<artifactId>mongock-standalone</artifactId>
<version>4.1.14</version>
</dependency>
<dependency>
<groupId>com.github.cloudyrock.mongock</groupId>
<artifactId>mongodb-v3-driver</artifactId>
<version>4.1.14</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.11.0</version>
</dependency>
主类中的驱动代码:
MongockStandalone.builder()
.setDriver(MongoCore3Driver.withDefaultLock(mongoClient, "demo"))
.addChangeLogsScanPackage("co.my.test.persistence.changelog")
.buildRunner();
变更日志类:
package co.my.test.persistence.changelog;
//imports
@ChangeLog(order = "001")
public class Changelog001 {
@ChangeSet(order = "001", id = "test", author = "Igor Flakiewicz")
public void test() {
// this method is never executed, the sout doesn't occur and breakpoints are not reached
System.out.println("PLEASE WORK!");
// migration code
}
}