Description
Currently a converter set into the @ValueConverter
annotation (the one from Spring Data Elasticsearch, not the newer one from Spring Data Commons) can only have a no-arg constructor and has no information of the type that the annotation is put on.
Coming from the discussion in #2486 it should be possible to have this information. The long term solution sure is to use the logic from the spring-data-commons module which was introduced after Spring Data Elasticsearch had this feature, for this #2488 exists.
Looking at the code there is a short term solution if we allow the converter class specified in the annotation to derive from AbstractPropertyValueConverter
. It then in the convert method has access to the proprties type by calling getProperty().getType()