@Configuration(proxyBeanMethods=false) public abstract class AbstractR2dbcConfiguration extends Object implements ApplicationContextAware
ConnectionFactory
,
DatabaseClient
,
EnableR2dbcRepositories
Constructor and Description |
---|
AbstractR2dbcConfiguration() |
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext
in interface ApplicationContextAware
BeansException
public abstract ConnectionFactory connectionFactory()
ConnectionFactory
. Annotate with Bean
in case you want to expose a
ConnectionFactory
instance to the ApplicationContext
.ConnectionFactory
.public R2dbcDialect getDialect(ConnectionFactory connectionFactory)
R2dbcDialect
for the given ConnectionFactory
. This method attempts to resolve a
R2dbcDialect
from ConnectionFactoryMetadata
. Override this method to specify a dialect
instead of attempting to resolve one.connectionFactory
- the configured ConnectionFactory
.R2dbcDialect
.DialectResolver.NoDialectException
- if the R2dbcDialect
cannot be determined.@Bean(value={"r2dbcDatabaseClient","databaseClient"}) public DatabaseClient databaseClient()
IllegalArgumentException
- if any of the required args is null.@Bean public R2dbcEntityTemplate r2dbcEntityTemplate(DatabaseClient databaseClient, ReactiveDataAccessStrategy dataAccessStrategy)
databaseClient
- must not be null.dataAccessStrategy
- must not be null.@Bean public R2dbcMappingContext r2dbcMappingContext(Optional<org.springframework.data.relational.core.mapping.NamingStrategy> namingStrategy, R2dbcCustomConversions r2dbcCustomConversions)
R2dbcMappingContext
and apply an optional NamingStrategy
.namingStrategy
- optional NamingStrategy
. Use NamingStrategy.INSTANCE
as fallback.r2dbcCustomConversions
- customized R2DBC conversions.IllegalArgumentException
- if any of the required args is null.@Bean public ReactiveDataAccessStrategy reactiveDataAccessStrategy(R2dbcConverter converter)
ReactiveDataAccessStrategy
using the configured
R2dbcConverter
.converter
- the configured R2dbcConverter
.IllegalArgumentException
- if any of the mappingContext is null.r2dbcConverter(R2dbcMappingContext, R2dbcCustomConversions)
,
getDialect(ConnectionFactory)
@Bean public MappingR2dbcConverter r2dbcConverter(R2dbcMappingContext mappingContext, R2dbcCustomConversions r2dbcCustomConversions)
R2dbcConverter
using the configured
r2dbcMappingContext(Optional, R2dbcCustomConversions)
R2dbcMappingContext}.mappingContext
- the configured R2dbcMappingContext
.r2dbcCustomConversions
- customized R2DBC conversions.IllegalArgumentException
- if any of the mappingContext is null.r2dbcMappingContext(Optional, R2dbcCustomConversions)
,
getDialect(ConnectionFactory)
@Bean public R2dbcCustomConversions r2dbcCustomConversions()
Converter
s in a CustomConversions
object if required. These
CustomConversions
will be registered with the BasicRelationalConverter
and
r2dbcMappingContext(Optional, R2dbcCustomConversions)
. Returns an empty R2dbcCustomConversions
instance by default. Override getCustomConverters()
to supply custom converters.getCustomConverters()
protected List<Object> getCustomConverters()
protected CustomConversions.StoreConversions getStoreConversions()
R2dbcDialect
-specific CustomConversions.StoreConversions
.R2dbcDialect
-specific CustomConversions.StoreConversions
.Copyright © 2018–2022 Pivotal Software, Inc.. All rights reserved.