vaj oja
vaj oja

Reputation: 1161

self-type does not conform error with play2reactivemongo

I met the following error after upgrading play2reactivemongo to 0.11.0.play24. The code compiles fine before the upgrade.

Code:

object TestController extends Controller with MongoController with CookieLang{

Error Message:

self-type controllers.TestController.type does not conform to play.modules.reactivemongo.MongoController's selftype play.modules.reactivemongo.MongoController with play.api.mvc.Controller with play.modules.reactivemongo.ReactiveMongoComponents

Upvotes: 1

Views: 400

Answers (1)

cchantep
cchantep

Reputation: 9168

As soon as Play 2.4 introduces the new dependency injection, your Mongo controller must extends MongoController with ReactiveMongoComponents (play.modules.reactivemongo.ReactiveMongoComponents).

The new trait indicates at compile time that your controller must be provided a reactiveMongoApi: ReactiveMongoApi (play.modules.reactivemongo.ReactiveMongoApi).

Then if you want to inject automatically this reactiveMongoApi, you will have to follow the steps indicated in the documentation.

Upvotes: 1

Related Questions