scala - What is an equivalent to Global.getControllerInstance in Play 2.4? -


i migrating (scala) play 2.3 app 2.4. had home-spun mechanism building controller objects, , provided them play using global.getcontrollerinstance. no longer available in 2.4. there simple way achieve same effect? i'd rather not switch using guice.

one option use guice module facade wrap custom controller generator. need write single guice class used play inject custom generated instances, without other changes.

here example in java. (sorry, not have scala example handy).

package com.example; class controllerprovidermodule extends abstractmodule {      @provides     mycontroller1 providesmycontroller1() {         // create mycontroller1 , return it.     }      @provides     mycontroller2 providesmycontroller2() {         // create mycontroller2 , return it.     }      @override     protected void configure() {         // alternatively, use other approaches bind controller classes custom generated instances      } } 

add module play.

play.modules.enabled += "com.example.controllerprovidermodule" 

Comments