0

Is it possible to use the WrappingNeoServerBootstrapper with spring-data-neo4j?

When using an embedded database without spring-data-neo4j, one can use a WrappingNeoServerBootstrapper to enable the REST-interface and the Webadmin. I use spring-data-neo4j and an embedded db (<neo4j:config storeDirectory="target/graph.db"/> in spring context) and would like to use the webadmin and rest-interface.

Is there any way to accomplish this?

I am also wondering if spring-data-neo4j-rest handles transactions?

Stedy
  • 7,359
  • 14
  • 57
  • 77
Tobias
  • 60
  • 1
  • 6

1 Answers1

3

That should be no problem. The config below is not tested, but should work and give you an idea how to set it up.

<neo4j:config graphDatabaseService="gds"/>

<bean id="gds" class="...EmbeddedGraphDatabase">
  <constructor-arg value="target/graph-db"/>
</bean>

<bean id="serverWrapper" class="...WrappingNeoServerBootstrapper" init-method="start" destroy-method="stop">
   <constructor-arg ref="gds"/>
</bean>

Transactions are handled the same way as the Neo4j-REST API does it. One per request. The underlying neo4j-rest-graphdb library also supports the REST-Batch API but that is not yet leveraged in SDN.

Update:

Please also add the dependency for the webadmin static files to your project, something like this:

<dependency>
  <groupId>org.neo4j.app</groupId>
  <artifactId>neo4j-server</artifactId>
  <version>1.5</version>
  <type>jar</type>
  <classifier>static-web</classifier>
</dependency>
Michael Hunger
  • 41,339
  • 3
  • 57
  • 80
  • 1
    Thanks for your rapid answer! I implemented your changes and it does work, except for the Webadmin. When I browse to localhost:7474 there is a 404 error: `code` HTTP ERROR 404 Problem accessing /webadmin/. Reason: Not Found `code` - the console ommits `code` 14.11.2011 14:30:53 org.neo4j.server.logging.Logger log SCHWERWIEGEND: No static content available for Neo Server at port [7474], management console may not be available. `code` – Tobias Nov 14 '11 at 19:02
  • could you please look into this again? (just found out that i have to tag them a user in order to notify them :) ) – Tobias Nov 16 '11 at 18:01
  • @TobiasS. can you tell me how you resolved 404 error in this case coz i'm also facing the same problem. – Prabhat Jan 15 '14 at 11:16
  • @Prabhat Please take a look at MichaelHunger's updated answer. I was missing the "neo4j-server" dependency. – Tobias Jan 16 '14 at 12:20