Class AbstractReactiveNeo4jConfig
java.lang.Object
org.springframework.data.neo4j.config.AbstractReactiveNeo4jConfig
@Configuration
@API(status=STABLE,
since="6.0")
public abstract class AbstractReactiveNeo4jConfig
extends Object
Base class for reactive SDN configuration using JavaConfig. This can be included in all scenarios in which Spring
Boot is not an option.
- Since:
- 6.0
- Author:
- Gerrit Meier, Michael J. Simons
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.neo4j.cypherdsl.core.renderer.Configuration
abstract org.neo4j.driver.Driver
driver()
The driver to be used for interacting with Neo4j.Scans the mapping base package for classes annotated withNode
.protected Collection<String>
Returns the base packages to scan for Neo4j mapped entities at startup.neo4jClient
(org.neo4j.driver.Driver driver, ReactiveDatabaseSelectionProvider databaseSelectionProvider) The driver used here should be the driver resulting fromdriver()
, which is the default.neo4jMappingContext
(Neo4jConversions neo4JConversions) Creates aNeo4jMappingContext
equipped with entity classes scanned from the mapping base package.neo4jTemplate
(ReactiveNeo4jClient neo4jClient, Neo4jMappingContext mappingContext) protected ReactiveDatabaseSelectionProvider
Configures the database name provider.reactiveTransactionManager
(org.neo4j.driver.Driver driver, ReactiveDatabaseSelectionProvider databaseSelectionProvider) Provides aPlatformTransactionManager
for Neo4j based on the driver resulting fromdriver()
.scanForEntities
(String basePackage) Deprecated.
-
Constructor Details
-
AbstractReactiveNeo4jConfig
public AbstractReactiveNeo4jConfig()
-
-
Method Details
-
driver
public abstract org.neo4j.driver.Driver driver()The driver to be used for interacting with Neo4j.- Returns:
- the Neo4j Java driver instance to work with.
-
neo4jClient
@Bean("reactiveNeo4jClient") public ReactiveNeo4jClient neo4jClient(org.neo4j.driver.Driver driver, ReactiveDatabaseSelectionProvider databaseSelectionProvider) The driver used here should be the driver resulting fromdriver()
, which is the default.- Parameters:
driver
- The driver to connect with.- Returns:
- A reactive Neo4j client.
-
neo4jTemplate
@Bean("reactiveNeo4jTemplate") public ReactiveNeo4jTemplate neo4jTemplate(ReactiveNeo4jClient neo4jClient, Neo4jMappingContext mappingContext) -
reactiveTransactionManager
@Bean("reactiveTransactionManager") public ReactiveTransactionManager reactiveTransactionManager(org.neo4j.driver.Driver driver, ReactiveDatabaseSelectionProvider databaseSelectionProvider) Provides aPlatformTransactionManager
for Neo4j based on the driver resulting fromdriver()
.- Parameters:
driver
- The driver to synchronize against- Returns:
- A platform transaction manager
-
bookmarkManager
-
reactiveDatabaseSelectionProvider
Configures the database name provider.- Returns:
- The default database name provider, defaulting to the default database on Neo4j 4.0 and on no default on Neo4j 3.5 and prior.
-
neo4jConversions
-
cypherDslConfiguration
-
neo4jMappingContext
@Bean public Neo4jMappingContext neo4jMappingContext(Neo4jConversions neo4JConversions) throws ClassNotFoundException Creates aNeo4jMappingContext
equipped with entity classes scanned from the mapping base package.- Returns:
- A new
Neo4jMappingContext
with initial classes to scan for entities set. - Throws:
ClassNotFoundException
- See Also:
-
getMappingBasePackages
Returns the base packages to scan for Neo4j mapped entities at startup. Will return the package name of the configuration class' (the concrete class, not this one here) by default. So if you have acom.acme.AppConfig
extendingNeo4jConfigurationSupport
the base package will be consideredcom.acme
unless the method is overridden to implement alternate behavior.- Returns:
- the base packages to scan for mapped
Node
classes or an empty collection to not enable scanning for entities.
-
getInitialEntitySet
Scans the mapping base package for classes annotated withNode
. By default, it scans for entities in all packages returned bygetMappingBasePackages()
.- Returns:
- initial set of domain classes
- Throws:
ClassNotFoundException
- if the given class cannot be found in the class path.- See Also:
-
scanForEntities
@Deprecated protected final Set<Class<?>> scanForEntities(String basePackage) throws ClassNotFoundException Deprecated.since 6.0.2 UseNeo4jEntityScanner
instead.Scans the given base package for entities, i.e. Neo4j specific types annotated withNode
.- Parameters:
basePackage
- must not be null.- Returns:
- found entities in the package to scan.
- Throws:
ClassNotFoundException
- if the given class cannot be loaded by the class loader.
-
Neo4jEntityScanner
instead.