Skip to content

Instantly share code, notes, and snippets.

@magaton
Created February 6, 2017 09:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magaton/da0e98ed7cf7fcf7852cf51baf167e40 to your computer and use it in GitHub Desktop.
Save magaton/da0e98ed7cf7fcf7852cf51baf167e40 to your computer and use it in GitHub Desktop.
@Configuration
@EnableNeo4jRepositories(basePackages="com.magaton.reco.repository.neo4j", transactionManagerRef = "neo4jTransactionManager")
@EnableTransactionManagement
@EnableConfigurationProperties(Neo4jProperties.class)
public class Neo4jConfiguration extends WebMvcConfigurerAdapter {
private final Logger log = LoggerFactory.getLogger(Neo4jConfiguration.class);
@Bean
public org.neo4j.ogm.config.Configuration configuration(Neo4jProperties properties) {
return properties.createConfiguration();
}
@Bean
public SessionFactory sessionFactory(org.neo4j.ogm.config.Configuration configuration) {
return new SessionFactory(configuration, "com.magaton.reco.domain.neo4j");
}
@Bean
public Neo4jTransactionManager neo4jTransactionManager(org.neo4j.ogm.config.Configuration configuration) {
return new Neo4jTransactionManager(sessionFactory(configuration));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment