简体   繁体   中英

How to configure spring-data-neo4j with standalone neo4j server?

I am currently running my webapp with an embedded neo4j. Now I want to change to a standalone neo4j server. While looking into working with the standalone server I stumbled over spring-data-neo4j. Having worked with spring-data-jpa and remembering how easy it was to connect to a db I started looking for a good tutorial how to work with spring-data-neo4j.

It seems possible with spring-data-neo4j-rest. That leaves the question how to configure it with java config, not with xml.

The spring data neo4j doc doesn't provide any infos on that.

You just have to implement a config class that creates a SpringRestGraphDatabase with your URL.

Something like:

@Configuration
@EnableNeo4jRepositories(basePackages = "org.springframework.data.neo4j.repository")
static class Config extends Neo4jConfiguration {

    @Bean
    public GraphDatabaseService graphDatabaseService() {
        return new SpringRestGraphDatabase("http://localhost:7474/db/data/");
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM