Skip to content

Fix CustomConverter conversion lookup. #3580

Closed
@christophstrobl

Description

@christophstrobl

The change (be8e702) introduced a more concrete converter lookup which causes trouble using the underlying ConversionService that might not have the converter registered for the given type but one of its parent ones. This leads to a ConverterNotFoundException during the mapping process.

interface Message<T> {
	T getValue();
}

class GenericMessage<T> implements Message<T> {
	T value;
}

class TypedMessage extends GenericMessage<String> {
}

@ReadingConverter
class MessageConverter implements Converter<Document, Message<?>> {
	@Override
	public Message<?> convert(org.bson.Document source) {
		// ...
	}
}

// ...

Document source = new Document("_class", TypedMessage.class.getName())
		.append("value", "v1");

Message<?> target = converter.read(Message.class, source);

Metadata

Metadata

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions