I have a class declared like this:
class XYZ(implicit sys: ActorSystem) extends Enricher {
}
In a function, I am instantiating the class using the name of the class(here: className).
I tried to do it like this:
val clazz = Class.forName(className, true, getClass.getClassLoader)
asSubclass classOf[Enricher]
clazz.newInstance()
But this only works if the constructor does not require any argument.
How do I go about this?