I've injected the messagesApi into my controller as documented (Play 2.4.x):
@Scope(value = "singleton")
@Component
class MyController @Inject()(val messagesApi: MessagesApi) extends Controller with I18nSupport
But on boot getting:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [play.api.i18n.MessagesApi] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
You need to extend your controller with either
BaseControllerorInjectedController; so your code will be:For more details you can look at the Play's documents.