Advertisement
Guest User

Untitled

a guest
Jul 19th, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.28 KB | None | 0 0
  1. package com.samples.neo4j.context;
  2.  
  3. import org.neo4j.ogm.session.Session;
  4. import org.neo4j.ogm.session.SessionFactory;
  5. import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  6. import org.springframework.context.annotation.Bean;
  7. import org.springframework.context.annotation.ComponentScan;
  8. import org.springframework.context.annotation.Configuration;
  9. import org.springframework.context.annotation.FilterType;
  10. import org.springframework.data.neo4j.config.Neo4jConfiguration;
  11. import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories;
  12. import org.springframework.transaction.annotation.EnableTransactionManagement;
  13.  
  14. import com.samples.neo4j.Application;
  15.  
  16. @Configuration
  17. @EnableNeo4jRepositories("com.samples.neo4j.repository")
  18. @EnableTransactionManagement
  19. @ComponentScan(excludeFilters = {
  20.     @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = Application.class) }, basePackages = {
  21.         "com.samples.neo4j" })
  22. @EnableAutoConfiguration
  23. public class PersistenceContext extends Neo4jConfiguration {
  24.  
  25.   @Override
  26.   public SessionFactory getSessionFactory() {
  27.     return new SessionFactory("com.samples.neo4j.domain");
  28.   }
  29.  
  30.   @Override
  31.   @Bean
  32.   public Session getSession() throws Exception {
  33.     return super.getSession();
  34.   }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement