joesan
joesan

Reputation: 15425

Play Framework 2.5 Loading Application

I would like to know how I could get a reference to the Play's ActorSystem with the Play Framework 2.5. From the official documentation, it states that I could inject the ActorSystem in my controller using the @Inject annotation, but I would like to refrain from using this. Is there an alternate way where I could get a reference to the ActorSystem? Any suggestions?

From the API, I can see that there is this AhcWSComponents and this contains the ActorSystem the Materializer that I need, but if I extend this, I should override a plethora of stuff which I do not want. So please give me some suggestions on how I could get a reference to the Play's ActorSystem without the need for using the @Inject annotation!

Upvotes: 0

Views: 97

Answers (1)

jacks
jacks

Reputation: 4773

Play provides some support for compile time DI of the built-in components such as the ActorSystem. Here is the trait.

You will need to configure an ApplicationLoader.

Upvotes: 2

Related Questions