Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EnableTransactionManagement
- @EnableScheduling
- @Configuration
- @EnableNeo4jRepositories(basePackages = "com.mycompany.analytics.graph.repository")
- public class Neo4jConfig extends Neo4jConfiguration {
- public static final String URL = System.getenv("NEO4J_URL") != null ? System.getenv("NEO4J_URL") : "http://neo4j:movies@localhost:7474";
- @Bean
- public org.neo4j.ogm.config.Configuration getConfiguration() {
- org.neo4j.ogm.config.Configuration config = new org.neo4j.ogm.config.Configuration();
- config
- .driverConfiguration()
- .setDriverClassName("org.neo4j.ogm.drivers.http.driver.HttpDriver")
- .setURI(URL);
- return config;
- }
- @Override
- public SessionFactory getSessionFactory() {
- return new SessionFactory(getConfiguration(), "com.mycompany.analytics.graph.repository");
- }
- }
- /**
- * Spring Data JPA repository for the User entity.
- */
- public interface UserRepository extends JpaRepository<User, Long> {
- Optional<User> findOneByActivationKey(String activationKey);
- List<User> findAllByActivatedIsFalseAndCreatedDateBefore(ZonedDateTime dateTime);
- Optional<User> findOneByResetKey(String resetKey);
- Optional<User> findOneByEmail(String email);
- Optional<User> findOneByLogin(String login);
- Optional<User> findOneById(Long userId);
- @Override
- void delete(User t);
- }
- @Service
- @Transactional
- public class UserService {
- ....
- @Inject
- private UserRepository userRepository;
- ....
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement