I have pre-existing code that calls the createInstanceFor
method of akka.actor.ReflectiveDynamicAccess
. This code essentially loops through a bunch of config values and creates instances based on the configuration (the class name is provided in the config). However, I had to update the definition of one of my classes like so.
//Old way
class MyClass(val1: String)
//New way
class MyClass(val1: String, val2: String = "defaultValue").
However, this causes the reflection object instantiation to fail with a java.lang.NoSuchMethodException
. So it looks like it's not picking up that defaultValue
.
Does anyone know a way around this? I know I could worst case I could update the config to include the default value, but this would result in a ton of duplication on the default value.
Thanks.
Aucun commentaire:
Enregistrer un commentaire