jarandaf
jarandaf

Reputation: 4427

Multiple neo4j instances configuration

I'm wondering how to set up two different neo4j server instances when using Spring Data, e.g. one for test and the other for production purposes. I have my production server instance running on default port (7474) and my test server instance running on port 7475. How can I define where my node/relationships entities should be stored (whether in test or production environment, in this case)? I was not able to find it in the docs. This was my beans file so far, running everything just out the box (when I just used a single neo4j server instance):

    <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:context="http://www.springframework.org/schema/context"
          xmlns:mongo="http://www.springframework.org/schema/data/mongo"
          xmlns:neo4j="http://www.springframework.org/schema/data/neo4j"
          xsi:schemaLocation=
          "http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context-3.0.xsd
          http://www.springframework.org/schema/data/mongo
          http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/data/neo4j
          http://www.springframework.org/schema/data/neo4j/spring-neo4j.xsd">

    <!-- Neo4j -->
    <neo4j:config storeDirectory="data/graph.db"/>
    <neo4j:repositories base-package="repositories.neo4j"/>

    <!-- some more stuff -->

Thank you all in advance!

Upvotes: 0

Views: 377

Answers (2)

tstorms
tstorms

Reputation: 5001

If you're using maven, also consider maven profiles. Here's a good comparison between spring and maven profiles: maven profiles or spring profiles?

Upvotes: 1

fbiville
fbiville

Reputation: 8970

You can benefit from Spring environment abstraction or Spring profiles. They both allow environment-dependent configurations.

Upvotes: 0

Related Questions