1

我正在尝试在 play java 项目中扩展 GuiceApplicationLoader,如官方播放文档中所示。(https://www.playframework.com/documentation/2.6.x/JavaDependencyInjection

我收到以下错误:

play.api.UnexpectedException:意外异常[ConfigurationException:Guice配置错误:

1) play.Application 没有实现。同时定位play.Application

我正在使用文档中显示的相同代码片段。

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));
}

}

任何建议为什么会发生这种情况?

4

0 回答 0