As the EmbeddedGraphDatabase
class is deprecated (it will be hidden in a future release), it's a good practice to already avoid it. The best way to build a GraphDatabaseSerice
, is by using the GraphDatabaseFactory
and in your case the related GraphDatabaseBuilder
. If you'd configure your Spring beans in java, this is what it could look like:
@Configuration
@ImportResource("applicationContext.xml")
class SpringConfiguration extends Neo4jConfiguration {
@Bean(destroyMethod = "shutdown")
public GraphDatabaseService graphDatabaseService() {
return new GraphDatabaseFactory().newEmbeddedDatabaseBuilder("db")
.setConfig("enable_remote_shell", "true").newGraphDatabase();
}
}
I realize that the setConfig
method I'm using is deprecated as well, but I don't see an equivalent in the GraphDatabaseSettings
class.
If you want to use this approach, you'll have to use a AnnotationConfigWebApplicationContext
in your web.xml.
If you wish to continue with XML configuration, there' a convenience bean:
<bean id="graphDatabaseService" class="org.springframework.data.neo4j.support.GraphDatabaseServiceFactoryBean"
destroy-method="shutdown" scope="singleton">
<constructor-arg value="db"/>
<constructor-arg>
<map>
<entry key="enable_remote_shell" value="true"/>
</map>
</constructor-arg>
</bean>