spring 数据 neo4j 嵌入式:连接到 localhost:7474 失败:连接被拒绝
spring data neo4j Embedded : Connect to localhost:7474 failed: Connection refused
具有此配置:
@Configuration
@EnableNeo4jRepositories("com.mydb.repository")
@EnableTransactionManagement
public class Neo4jConfig extends Neo4jConfiguration {
@Bean
@Override
public Neo4jServer neo4jServer() {
return new RemoteServer( "http://localhost:7474" );
}
@Bean
public GraphDatabaseService graphDatabaseService() {
return new GraphDatabaseFactory().newEmbeddedDatabaseBuilder( new File("./mydb.db") )
.setConfig( ServerSettings.auth_enabled, Boolean.FALSE.toString() )
.newGraphDatabase();
}
@Bean
@Override
@Scope(proxyMode = ScopedProxyMode.TARGET_CLASS)
public Session getSession() throws Exception {
return super.getSession();
}
@Bean
@Override
public SessionFactory getSessionFactory() {
return new SessionFactory("com.mydb.model");
}
}
我有 2 个错误:
1_ 我无法将 Session 保持在范围内 "session"
2_ 我有异常:连接到 localhost:7474 失败:连接被拒绝:
服务器是嵌入式的,它应该无需在我的本地计算机上安装任何服务器即可启动?
Spring-boot 1.3.0 (Last) and
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
Spring Data for Neo4j 的 4.0 版不支持 Neo4j 的嵌入式版本。
您需要在本地计算机上安装 Neo4j。
"SDN 4.1 will support embedded version." @Luanne
具有此配置:
@Configuration
@EnableNeo4jRepositories("com.mydb.repository")
@EnableTransactionManagement
public class Neo4jConfig extends Neo4jConfiguration {
@Bean
@Override
public Neo4jServer neo4jServer() {
return new RemoteServer( "http://localhost:7474" );
}
@Bean
public GraphDatabaseService graphDatabaseService() {
return new GraphDatabaseFactory().newEmbeddedDatabaseBuilder( new File("./mydb.db") )
.setConfig( ServerSettings.auth_enabled, Boolean.FALSE.toString() )
.newGraphDatabase();
}
@Bean
@Override
@Scope(proxyMode = ScopedProxyMode.TARGET_CLASS)
public Session getSession() throws Exception {
return super.getSession();
}
@Bean
@Override
public SessionFactory getSessionFactory() {
return new SessionFactory("com.mydb.model");
}
}
我有 2 个错误:
1_ 我无法将 Session 保持在范围内 "session"
2_ 我有异常:连接到 localhost:7474 失败:连接被拒绝:
服务器是嵌入式的,它应该无需在我的本地计算机上安装任何服务器即可启动?
Spring-boot 1.3.0 (Last) and
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
Spring Data for Neo4j 的 4.0 版不支持 Neo4j 的嵌入式版本。
您需要在本地计算机上安装 Neo4j。
"SDN 4.1 will support embedded version." @Luanne