My web application uses Neo4j as a data storage, and it uses Spring Data Neo4j 4 framework.
As suggested in the tutorial, my neo4j session is bound to my HTTP session:
@Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
public Session getSession() throws Exception {
return super.getSession();
}
I have an endpoint which runs a time-consuming query, and sends the result offline. I'd like to move this method to an @Async
thread, but obviously I can not access my neo4j session from that thread.
What is the best practise to access neo4j repositories outside of the HTTP session without changing the scope of the "main" session bean?