1

I would like to know if someone can tell me how to inject an own implementation of ReactiveMongoApi into one specific controller.

class MyController @Inject() (val reactiveMongoApi: ReactiveMongoApi, val messagesApi: MessagesApi...) extends Controller ...

As far as I'm come I don't really get it, how to inject MyOwnReactiveMongoApi into MyController and only MyController. All other controllers should continue to use the default implementation.

I'm currently using: PlayFramework 2.4.2 and ReactiveMongo 0.11.6.play24

CubeJockey
  • 2,209
  • 8
  • 24
  • 31
Martor
  • 11
  • 2
  • Don't activate the RM module in the application conf, bind your own API instance from the application loader (or Guice module). – cchantep Sep 24 '15 at 08:02
  • Thank you, but that's not quite what I'm trying to achieve. This way, I would remove the default implementation and use mine instead. That would lead to the problem, that every controller would use my implementation, but I want to use it only in one (or more) specific controllers. – Martor Sep 24 '15 at 18:12
  • Play DI only maintain one binding per type. – cchantep Sep 24 '15 at 22:53

0 Answers0