我正在将一份现有的使用 Neo4j 2.x 的 Spring Data Neo4j 3 应用迁移至使用 Neo4j 3.0 和 Spring Data Neo4j 4.1。迁移已经完成,但应用程序现在启动时出现错误:
。
org.neo4j.kernel.impl.storemigration.UpgradeNotAllowedByConfigurationException: Failed to start Neo4j with an older data store version. To enable automatic upgrade, please set configuration parameter "dbms.allow_format_migration=true"
我之前在升级时就知道这个消息,以前我使用GraphDatabaseFactory创建嵌入式数据库时会在我的neo4j.properties中手动配置它。
然而,在使用SDN 4时,这不再是必需/可能的。根据文档中的说明,我现在只需要:
@Bean
public Configuration getConfiguration()
{
String uri = getDatabaseUri();
Configuration config = new org.neo4j.ogm.config.Configuration();
config.set("dbms.allow_format_migration", "true"); // Allow upgrade of neo4j version
config.driverConfiguration()
.setDriverClassName("org.neo4j.ogm.drivers.embedded.driver.EmbeddedDriver")
.setURI(uri);
return config;
}
看起来可以设置额外的配置,但是没有效果。我也尝试将neo4j.conf放置在(嵌入式)DB文件夹中,并设置此选项,但没有成功。
现在如何配置嵌入式实例?