Class JdbcConfiguration

java.lang.Object
org.springframework.data.jdbc.repository.config.JdbcConfiguration

public final class JdbcConfiguration extends Object
Utility class to providing factory methods for JDBC infrastructure components.

Mainly for use within the framework or for configuration arrangements that require customization of configuration.

Since:
4.0
Author:
Mark Paluch
  • Method Details

    • createCustomConversions

      public static JdbcCustomConversions createCustomConversions(JdbcDialect dialect, List<?> userConverters)
      Register custom Converters in a JdbcCustomConversions object if required.
      Parameters:
      dialect - the JDBC dialect in use.
      userConverters - list of user converters, must not be null.
      Returns:
      will never be null.
    • createMappingContext

      public static JdbcMappingContext createMappingContext(org.springframework.data.relational.RelationalManagedTypes jdbcManagedTypes, JdbcCustomConversions customConversions, @Nullable org.springframework.data.relational.core.mapping.NamingStrategy namingStrategy)
      Register a JdbcMappingContext and apply an optional NamingStrategy.
      Parameters:
      jdbcManagedTypes - JDBC managed types.
      customConversions - the custom conversions.
      namingStrategy - optional NamingStrategy. Use DefaultNamingStrategy.INSTANCE as fallback.
      Returns:
      must not be null.
    • createConverter

      public static JdbcConverter createConverter(JdbcMappingContext mappingContext, NamedParameterJdbcOperations operations, RelationResolver relationResolver, JdbcCustomConversions conversions, JdbcDialect dialect)
      Creates a JdbcConverter.
      Parameters:
      mappingContext - must not be null.
      operations - must not be null.
      relationResolver - must not be null.
      conversions - must not be null.
      dialect - the JDBC dialect in use.
      Returns:
      must not be null.
    • createDataAccessStrategy

      public static DataAccessStrategy createDataAccessStrategy(NamedParameterJdbcOperations operations, JdbcConverter jdbcConverter, @Nullable QueryMappingConfiguration mappingConfiguration, JdbcDialect 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.
      Parameters:
      operations - must not be null.
      jdbcConverter - must not be null.
      mappingConfiguration - mapping configuration, can be null.
      dialect - the JDBC dialect in use.
      Returns:
      will never be null.
    • scanForEntities

      public static Set<Class<?>> scanForEntities(String basePackage)
      Scans the given base package for entities, i.e. JDBC-specific types annotated with Table.
      Parameters:
      basePackage - must not be null.
      Returns:
      a set of classes identified as entities.