Skip to content

Instantly share code, notes, and snippets.

@aglassman
Created February 9, 2016 15:19
Show Gist options
  • Save aglassman/f1e40e4413fbf7ae3eac to your computer and use it in GitHub Desktop.
Save aglassman/f1e40e4413fbf7ae3eac to your computer and use it in GitHub Desktop.
package org.gmjm;
import org.neo4j.ogm.session.Session;
import org.neo4j.ogm.session.SessionFactory;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.data.neo4j.config.Neo4jConfiguration;
import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories;
import org.springframework.data.neo4j.server.Neo4jServer;
import org.springframework.data.neo4j.server.RemoteServer;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableNeo4jRepositories(basePackages = "org.gmjm.logistics")
@EnableTransactionManagement
@EnableAutoConfiguration
public class DemoNeo4jConfig extends Neo4jConfiguration
{
@Bean
public Neo4jServer neo4jServer()
{
return new RemoteServer("http://localhost:7474");
}
@Bean
public SessionFactory getSessionFactory()
{
return new SessionFactory("org.gmjm.logistics");
}
// needed for session in view in web-applications
@Bean
@Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
public Session getSession() throws Exception {
return super.getSession();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment