Skip to content

Latest commit

 

History

History
67 lines (49 loc) · 2.06 KB

README.md

File metadata and controls

67 lines (49 loc) · 2.06 KB

spring-social-neo4j

Spring Social UsersConnectionRepository/ConnectionRepository implementation for Neo4j.

Build Status

Using this library you can easily configure Spring Social for an application that use Neo4j as the database server.

  1. Add repository

    <repositories>
        <repository>
            <id>spring-social-neo4j</id>
            <url>https://raw.github.com/shanika/spring-social-neo4j/mvn-repo/</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
    </repositories>
  2. Add dependency

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-social-neo4j</artifactId>
        <version>0.0.2-SNAPSHOT</version>
    </dependency>
  3. Configure UsersConnectionRepository in spring social config

    3.1 Simple usage (no existing neo4j session/sessionfactory)

    @Autowired
    private Neo4jServer server;
    
    @Override
    public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    
        return new Neo4jUsersConnectionRepository(server.url(), connectionFactoryLocator, Encryptors.noOpText());
    }

3.2 with a shared neo4j session

* 3.2.1 First make sure "org.springframework.social.connect.neo4j.domain" is given at your factory creation 

   ```java
   new SessionFactory("com.mycustom.domains",...,"org.springframework.social.connect.neo4j.domain")
   ```

* 3.2.2 use this in spring social config

    ```java
    @Autowired
    Session session
    
    @Override
    public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
        return new Neo4jUsersConnectionRepository(session, connectionFactoryLocator, Encryptors.noOpText());
    }

    ```