Created
February 9, 2016 15:19
-
-
Save aglassman/f1e40e4413fbf7ae3eac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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