Skip to content

Deprecate *ConverterOverride classes in favor of R2dbcCustomConversionsConfiguration converter filters #750

@magiccrafter

Description

@magiccrafter

Hi team,

I'm struggling to understand the reasoning for having the converter overrides from the code snippet below:

from: R2dbcConverters

	/**
	 * @return A list of the registered converters to enforce JSR-310 type usage.
	 * @see CustomConversions#DEFAULT_CONVERTERS
	 * @see Jsr310Converters
	 */
	public static Collection<Object> getOverrideConvertersToRegister() {

		List<Object> converters = new ArrayList<>();

		converters.add(LocalDateConverterOverride.INSTANCE);
		converters.add(LocalDateTimeConverterOverride.INSTANCE);
		converters.add(LocalTimeConverterOverride.INSTANCE);

		return converters;
	}

The problem I face is that because of the overrides from the snippet above any custom converters specified for a custom R2dbcDialect implementation is being overridden and respectively ignored.

For example, in the following custom R2dbcDialect class the converters are ignored and the *Override's one take precedence:

public class CustomR2dbcDialect extends AbstractDialect implements R2dbcDialect {
   ...
    @Override
    public Collection<? extends Class<?>> getSimpleTypes() {
      return Arrays.asList(
        XTimestamp.class,
        XDate.class);
    }
  
    @Override
    public Collection<Object> getConverters() {
      return Arrays.asList(
        new LocalDateToXDateConverter(),
        new XDateToLocalDateConverter(),
        new LocalDateTimeToXTimestampConverter(),
        new XTimestampToLocalDateTimeConverter());
    }
    ...
  }

What is the purpose of the *ConverterOverride classes and does it make sense to remove the converter overrides?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions