2020import org .springframework .context .annotation .Bean ;
2121import org .springframework .context .annotation .Configuration ;
2222import org .springframework .core .convert .converter .Converter ;
23- import org .springframework .data .convert .CustomConversions ;
2423import org .springframework .data .jdbc .core .convert .JdbcCustomConversions ;
2524import org .springframework .data .relational .core .conversion .BasicRelationalConverter ;
2625import org .springframework .data .relational .core .conversion .RelationalConverter ;
3433 * @author Jens Schauder
3534 * @author Mark Paluch
3635 * @author Michael Simons
36+ * @author Christoph Strobl
3737 */
3838@ Configuration
3939public class JdbcConfiguration {
4040
41+ /**
42+ * Register a {@link RelationalMappingContext} and apply an optional {@link NamingStrategy}.
43+ *
44+ * @param namingStrategy optional {@link NamingStrategy}. Use {@link NamingStrategy#INSTANCE} as fallback.
45+ * @return must not be {@literal null}.
46+ */
4147@ Bean
4248protected RelationalMappingContext jdbcMappingContext (Optional <NamingStrategy > namingStrategy ) {
4349
@@ -48,16 +54,23 @@ protected RelationalMappingContext jdbcMappingContext(Optional<NamingStrategy> n
4854return mappingContext ;
4955}
5056
57+ /**
58+ * Creates a {@link RelationalConverter} using the configured {@link #jdbcMappingContext(Optional)}. Will get
59+ * {@link #jdbcCustomConversions()} applied.
60+ *
61+ * @see #jdbcMappingContext(Optional)
62+ * @see #jdbcCustomConversions()
63+ * @return must not be {@literal null}.
64+ */
5165@ Bean
5266protected RelationalConverter relationalConverter (RelationalMappingContext mappingContext ) {
5367return new BasicRelationalConverter (mappingContext , jdbcCustomConversions ());
5468}
5569
5670/**
57- * Register custom {@link Converter}s in a {@link CustomConversions} object if required. These
58- * {@link CustomConversions} will be registered with the
59- * {@link #relationalConverter(RelationalMappingContext)}. Returns an empty
60- * {@link JdbcCustomConversions} instance by default.
71+ * Register custom {@link Converter}s in a {@link JdbcCustomConversions} object if required. These
72+ * {@link JdbcCustomConversions} will be registered with the {@link #relationalConverter(RelationalMappingContext)}.
73+ * Returns an empty {@link JdbcCustomConversions} instance by default.
6174 *
6275 * @return must not be {@literal null}.
6376 */
0 commit comments