β08-05-2019 10:23 AM
spring-boot-starter-data-neo4j v2.1.5.RELEASE
I'm having an issue that only occurs when running tests. It seems that none of the standard numeric value converters are available while running tests, resulting in errors like
No converter found capable of converting from type [java.lang.Long] to type [java.lang.Double]
For instance, I may have a Float value on a relationship property, but if Neo4j has this as a Long or Double, the conversion fails. This does not happen when executing normally; only while running tests.
Does this sound familiar to anyone? Thanks!
β08-05-2019 11:11 AM
Itβs a twisted rope to follow behind the Spring magic. I think it may be an autowiring issue. I see the default/main conversionService gets fully populated with converters. That appears like it should come in via Neo4jOgmEntityInstantiatorConfigurationBean
, but if it doesnβt, one is synthesized:
ConversionService conversionService = conversionServiceObjectProvider
.getIfUnique(() -> new MetaDataDrivenConversionService(metaData));
And it appears the synthesized one is used, which has an empty converters
array. So thatβs a better handle on What, still doesnβt explain the Why.
I put a breakpoint Neo4jOgmEntityInstantiatorConfigurationBean:38
to see this in action β which is called by an even more opaque NativeConstructorAccessorImpl
and a stack tracing to BeanUtils.
When executing normally, this comes populated with 169 converters! What would be different when running tests?
β12-15-2020 07:37 AM
I am experiencing the same issue with missing standard converters in tests. Did you find a solution in the meantime?
All the sessions of the conference are now available online