org.springframework.data.jdbc.repository.config

## Class AbstractJdbcConfiguration

- java.lang.Object
- - org.springframework.data.jdbc.repository.config.AbstractJdbcConfiguration

Direct Known Subclasses:
  MyBatisJdbcConfiguration

    @Configuration(proxyBeanMethods=false)
    public class AbstractJdbcConfiguration
    extends Object

Beans that must be registered for Spring Data JDBC to work.

Since:
  1.1
Author:
  Greg Turnquist, Jens Schauder, Mark Paluch, Michael Simons, Christoph Strobl, Myeonghyeon Lee

### Constructor Summary

Constructors
Constructor and Description
`AbstractJdbcConfiguration()`

### Method Summary

All Methods Instance Methods Concrete Methods
`DataAccessStrategy` `dataAccessStrategyBean(NamedParameterJdbcOperations operations, JdbcConverter jdbcConverter, JdbcMappingContext context, Dialect dialect)` Create a `DataAccessStrategy` for reuse in the `JdbcAggregateOperations` and the `JdbcConverter`.
`JdbcAggregateTemplate` `jdbcAggregateTemplate(ApplicationContext applicationContext, JdbcMappingContext mappingContext, JdbcConverter converter, DataAccessStrategy dataAccessStrategy)` Register a `JdbcAggregateTemplate` as a bean for easy use in applications that need a lower level of abstraction than the normal repository abstraction.
`JdbcConverter` `jdbcConverter(JdbcMappingContext mappingContext, NamedParameterJdbcOperations operations, RelationResolver relationResolver, JdbcCustomConversions conversions, Dialect dialect)` Creates a `RelationalConverter` using the configured `jdbcMappingContext(Optional, JdbcCustomConversions)`.
`JdbcCustomConversions` `jdbcCustomConversions()` Register custom `Converter`s in a `JdbcCustomConversions` object if required.
`Dialect` `jdbcDialect(NamedParameterJdbcOperations operations)` Resolves a `JDBC dialect` by inspecting `NamedParameterJdbcOperations`.
`JdbcMappingContext` `jdbcMappingContext(Optional<NamingStrategy> namingStrategy, JdbcCustomConversions customConversions)` Register a `JdbcMappingContext` and apply an optional `NamingStrategy`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### AbstractJdbcConfiguration

    public AbstractJdbcConfiguration()

### Method Detail

#### jdbcMappingContext

    @Bean
    public JdbcMappingContext jdbcMappingContext(Optional<NamingStrategy> namingStrategy,
                                                       JdbcCustomConversions customConversions)

Register a `JdbcMappingContext` and apply an optional `NamingStrategy`.

Parameters:
  `namingStrategy` - optional `NamingStrategy`. Use `NamingStrategy.INSTANCE` as fallback.
  `customConversions` - see `jdbcCustomConversions()`.
Returns:
  must not be null.

#### jdbcConverter

    @Bean
    public JdbcConverter jdbcConverter(JdbcMappingContext mappingContext,
                                             NamedParameterJdbcOperations operations,
                                             @Lazy
                                             RelationResolver relationResolver,
                                             JdbcCustomConversions conversions,
                                             Dialect dialect)

Creates a `RelationalConverter` using the configured `jdbcMappingContext(Optional, JdbcCustomConversions)`. Will get `jdbcCustomConversions()` applied.

Returns:
  must not be null.
See Also:
  `jdbcMappingContext(Optional, JdbcCustomConversions)`, `jdbcCustomConversions()`

#### jdbcCustomConversions

    @Bean
    public JdbcCustomConversions jdbcCustomConversions()

Register custom `Converter`s in a `JdbcCustomConversions` object if required. These `JdbcCustomConversions` will be registered with the `jdbcConverter(JdbcMappingContext, NamedParameterJdbcOperations, RelationResolver, JdbcCustomConversions, Dialect)`. Returns an empty `JdbcCustomConversions` instance by default.

Returns:
  will never be null.

#### jdbcAggregateTemplate

    @Bean
    public JdbcAggregateTemplate jdbcAggregateTemplate(ApplicationContext applicationContext,
                                                             JdbcMappingContext mappingContext,
                                                             JdbcConverter converter,
                                                             DataAccessStrategy dataAccessStrategy)

Register a `JdbcAggregateTemplate` as a bean for easy use in applications that need a lower level of abstraction than the normal repository abstraction.

Parameters:
  `applicationContext` - for publishing events. Must not be null.
  `mappingContext` - the mapping context to be used. Must not be null.
  `converter` - the conversions used when reading and writing from/to the database. Must not be null.
Returns:
  a `JdbcAggregateTemplate`. Will never be null.

#### dataAccessStrategyBean

    @Bean
    public DataAccessStrategy dataAccessStrategyBean(NamedParameterJdbcOperations operations,
                                                           JdbcConverter jdbcConverter,
                                                           JdbcMappingContext context,
                                                           Dialect dialect)

Create a `DataAccessStrategy` for reuse in the `JdbcAggregateOperations` and the `JdbcConverter`. Override this method to register a bean of type `DataAccessStrategy` if your use case requires a more specialized `DataAccessStrategy`.

Returns:
  will never be null.

#### jdbcDialect

    @Bean
    public Dialect jdbcDialect(NamedParameterJdbcOperations operations)

Resolves a `JDBC dialect` by inspecting `NamedParameterJdbcOperations`.

Parameters:
  `operations` - the `NamedParameterJdbcOperations` allowing access to a `Connection`.
Returns:
Throws:
  `DialectResolver.NoDialectException` - if the `Dialect` cannot be determined.
Since:
  2.0