1

When defining a class where I need to load my Akka implicits from Main I do like this:

class Example()(implicit system: ActorSystem, materializer: ActorMaterializer)

However I wish to do the exact same thing using an object, is there a way to do this?

Dmytro Mitin
  • 48,194
  • 3
  • 28
  • 66
  • 5
    An object is a singleton, there is only one instance of such class all over the lifetime of the program. As such, if that singleton is going to use some implicits they all have to be defined at the moment of the definition of the object, which is probably not what you want. – Luis Miguel Mejía Suárez Oct 25 '20 at 18:51
  • 1
    https://stackoverflow.com/questions/64286575/extending-an-object-with-a-trait-which-needs-implicit-member https://stackoverflow.com/questions/64267742/pass-implicit-parameter-through-multiple-objects – Dmytro Mitin Oct 26 '20 at 06:59
  • If you want to use a different ActorSystem and ActorMaterializer each time it is only possible by adding those parameters to object's methods. – Ava Oct 26 '20 at 09:32

0 Answers0