|
|
|
@ -33,31 +33,30 @@ import org.springframework.data.relational.core.mapping.RelationalMappingContext |
|
|
|
* @author Greg Turnquist |
|
|
|
* @author Greg Turnquist |
|
|
|
* @author Jens Schauder |
|
|
|
* @author Jens Schauder |
|
|
|
* @author Mark Paluch |
|
|
|
* @author Mark Paluch |
|
|
|
|
|
|
|
* @author Michael Simons |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Configuration |
|
|
|
@Configuration |
|
|
|
public class JdbcConfiguration { |
|
|
|
public class JdbcConfiguration { |
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
@Bean |
|
|
|
protected RelationalMappingContext jdbcMappingContext(Optional<NamingStrategy> namingStrategy, |
|
|
|
protected RelationalMappingContext jdbcMappingContext(Optional<NamingStrategy> namingStrategy) { |
|
|
|
CustomConversions customConversions) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RelationalMappingContext mappingContext = new RelationalMappingContext( |
|
|
|
RelationalMappingContext mappingContext = new RelationalMappingContext( |
|
|
|
namingStrategy.orElse(NamingStrategy.INSTANCE)); |
|
|
|
namingStrategy.orElse(NamingStrategy.INSTANCE)); |
|
|
|
mappingContext.setSimpleTypeHolder(customConversions.getSimpleTypeHolder()); |
|
|
|
mappingContext.setSimpleTypeHolder(jdbcCustomConversions().getSimpleTypeHolder()); |
|
|
|
|
|
|
|
|
|
|
|
return mappingContext; |
|
|
|
return mappingContext; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
@Bean |
|
|
|
protected RelationalConverter relationalConverter(RelationalMappingContext mappingContext, |
|
|
|
protected RelationalConverter relationalConverter(RelationalMappingContext mappingContext) { |
|
|
|
CustomConversions customConversions) { |
|
|
|
return new BasicRelationalConverter(mappingContext, jdbcCustomConversions()); |
|
|
|
return new BasicRelationalConverter(mappingContext, customConversions); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Register custom {@link Converter}s in a {@link CustomConversions} object if required. These |
|
|
|
* Register custom {@link Converter}s in a {@link CustomConversions} object if required. These |
|
|
|
* {@link CustomConversions} will be registered with the |
|
|
|
* {@link CustomConversions} will be registered with the |
|
|
|
* {@link #relationalConverter(RelationalMappingContext, CustomConversions)}. Returns an empty |
|
|
|
* {@link #relationalConverter(RelationalMappingContext)}. Returns an empty |
|
|
|
* {@link JdbcCustomConversions} instance by default. |
|
|
|
* {@link JdbcCustomConversions} instance by default. |
|
|
|
* |
|
|
|
* |
|
|
|
* @return must not be {@literal null}. |
|
|
|
* @return must not be {@literal null}. |
|
|
|
|