I am trying to Extend the GuiceApplicationLoader in play java project as shown here in official play documentation. (https://www.playframework.com/documentation/2.6.x/JavaDependencyInjection)
I am getting below error:
play.api.UnexpectedException: Unexpected exception[ConfigurationException: Guice configuration errors:
1) No implementation for play.Application was bound. while locating play.Application
I am using the same code snippet shown in docs.
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import play.ApplicationLoader;
import play.inject.guice.GuiceApplicationBuilder;
import play.inject.guice.GuiceApplicationLoader;
public class CustomApplicationLoader extends GuiceApplicationLoader {
@Override
public GuiceApplicationBuilder builder(ApplicationLoader.Context context) {
Config extra = ConfigFactory.parseString("a = 1");
return initialBuilder
.in(context.environment())
.loadConfig(extra.withFallback(context.initialConfig()))
.overrides(overrides(context));
}
}
Any suggestion why this is happening ?