Spring Social UsersConnectionRepository/ConnectionRepository implementation for Neo4j.
Using this library you can easily configure Spring Social for an application that use Neo4j as the database server.
-
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>
-
Add dependency
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-social-neo4j</artifactId> <version>0.0.2-SNAPSHOT</version> </dependency>
-
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());
}
```