CORDA-2248 Remove spring boot hack. (#4305)

* CORDA-2248 Remove spring boot hack.
This commit is contained in:
Tudor Malene 2018-11-27 13:39:54 +00:00 committed by GitHub
parent 759fd9b5bb
commit e4c1db4db6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -189,20 +189,24 @@ abstract class AbstractAMQPSerializationScheme(
}
override fun <T : Any> deserialize(byteSequence: ByteSequence, clazz: Class<T>, context: SerializationContext): T {
var contextToUse = context
if (context.useCase == SerializationContext.UseCase.RPCClient) {
contextToUse = context.withClassLoader(getContextClassLoader())
}
val serializerFactory = getSerializerFactory(contextToUse)
// This is a hack introduced in version 3 to fix a spring boot issue - CORDA-1747.
// It breaks the shell because it overwrites the CordappClassloader with the system classloader that doesn't know about any CorDapps.
// In case a spring boot serialization issue with generics is found, a better solution needs to be found to address it.
// var contextToUse = context
// if (context.useCase == SerializationContext.UseCase.RPCClient) {
// contextToUse = context.withClassLoader(getContextClassLoader())
// }
val serializerFactory = getSerializerFactory(context)
return DeserializationInput(serializerFactory).deserialize(byteSequence, clazz, context)
}
override fun <T : Any> serialize(obj: T, context: SerializationContext): SerializedBytes<T> {
var contextToUse = context
if (context.useCase == SerializationContext.UseCase.RPCClient) {
contextToUse = context.withClassLoader(getContextClassLoader())
}
val serializerFactory = getSerializerFactory(contextToUse)
// See the above comment.
// var contextToUse = context
// if (context.useCase == SerializationContext.UseCase.RPCClient) {
// contextToUse = context.withClassLoader(getContextClassLoader())
// }
val serializerFactory = getSerializerFactory(context)
return SerializationOutput(serializerFactory).serialize(obj, context)
}