I am trying to migrate my app from 2.3 to 2.4. In our code base we have used Messages extensively, so any way to remove that will also help. Currently our code is like this
class MyController @Inject()
(val messagesApi: MessagesApi) extends Controller with I18nSupport{
def methodA() = {
new MyControllerService.doSomething()
}
}
class MyControllerService{
def doSomething()(implicit messages:Messages){
messages(any_key)
}
}
When compiling this code i am getting Error:(31, 84) Play 2 Compiler: could not find implicit value for parameter messages: play.api.i18n.Messages compile time error message.
Please help to resolve this issue, any suggestions to improve this kind of problem in better way is most welcome.
Do it in this way :
or you can pass created messages object directly in this way: