Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3641

SPRING NEO4J :: No converter found capable of converting from type [com.my_buzz.core_api_server.dtos.item.ItemDetail] to type [org.neo4j.driver.Value]

$
0
0

Below is my code as per my project ::

> I have below configurations ::@Configurationclass Neo4jConfig {    @Bean    fun neo4jConversions(): Neo4jConversions? {        val additionalConverters: Set<GenericConverter?> = Collections.singleton(DtoToNeo4jValueConverter())        return Neo4jConversions(additionalConverters)    }}class DtoToNeo4jValueConverter : GenericConverter {    override fun getConvertibleTypes(): Set<ConvertiblePair>? {        val convertiblePairs: MutableSet<ConvertiblePair> = HashSet()        convertiblePairs.add(ConvertiblePair(ItemDetail::class.java, Value::class.java))        convertiblePairs.add(ConvertiblePair(Value::class.java, ItemDetail::class.java))        return convertiblePairs    }    override fun convert(@Nullable source: Any?, sourceType: TypeDescriptor, targetType: TypeDescriptor): Any? {        return if (ItemDetail::class.java.isAssignableFrom(sourceType.type)) {            // generic way of converting an object into a map            val dataclassAsMap = jacksonObjectMapper().convertValue(source as ItemDetail, object :                TypeReference<Map<String, Any>>() {})            Values.value(dataclassAsMap)        } else {            return convertToNeo4jItemDetailType(source as ItemDetail)        }    }    private fun convertToNeo4jItemDetailType(source: ItemDetail): Neo4jItemDetail {        println("I came here ....")        return Neo4jItemDetail(            ....        ) // neo4j primitive type data class     }}

convertToNeo4jItemDetailType methods println never gets called, which should be as per my understanding or else it should have auto converted as per the overriden convert function above.

No matter what I do I always get the exception as No converter found capable of converting from type [com.my_buzz.core_api_server.dtos.item.ItemDetail] to type [org.neo4j.driver.Value]

I am not getting any solution over google from the spring community for the same, And I am really fed by now ... please get me out of this trouble else I have to switch to other framework


Viewing all articles
Browse latest Browse all 3641

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>