[GUICE/MISTIMPLENTION]:Viewloader没有实现

发布于 2025-02-12 04:03:18 字数 1963 浏览 1 评论 0原文

在运行 gradle运行时,我会遇到此错误:

1) [Guice/MissingImplementation]: No implementation for ViewLoader was bound.

Requested by:
1  : ModuleManager.<init>(ModuleManager.java:105)
      \_ for 3rd parameter
     at AppInitializer.moduleManager(AppInitializer.java:37)
      \_ for field moduleManager
     while locating AppInitializer

Learn more:

这是 modulemanager.java 的一部分

  @Inject
  public ModuleManager(
      AuthService authService,
      MetaModuleRepository modules,
      ViewLoader viewLoader,
      ModelLoader modelLoader,
      I18nLoader i18nLoader,
      DataLoader dataLoader,
      DemoLoader demoLoader) {
    this.authService = authService;
    this.modules = modules;
    this.viewLoader = viewLoader;
    this.dataLoader = dataLoader;
    this.demoLoader = demoLoader;
    metaLoaders = ImmutableList.of(modelLoader, viewLoader, i18nLoader);
  }

,而这是 view> view> view loadloader.java的一部分:


public abstract class ViewLoader extends AbstractParallelLoader {

  private static final Logger LOG = LoggerFactory.getLogger(ViewLoader.class);

  @Inject private ObjectMapper objectMapper;

  @Inject private MetaViewRepository views;

  @Inject private MetaSelectRepository selects;

  @Inject private MetaActionRepository actions;

  @Inject private MetaMenuRepository menus;

  @Inject private MetaActionMenuRepository actionMenus;

  @Inject private GroupRepository groups;

  @Inject private XMLViews.FinalViewGenerator finalViewGenerator;

  private final Set<String> viewsToGenerate = ConcurrentHashMap.newKeySet();
  private final Map<String, List<String>> viewsToMigrate = new ConcurrentHashMap<>();
  private final Map<String, List<Consumer<Group>>> groupsToCreate = new ConcurrentHashMap<>();

我希望这足以作为来源,我不能发布所有代码。 我不知道错误是什么意思。

I am getting this error when running gradle run :

1) [Guice/MissingImplementation]: No implementation for ViewLoader was bound.

Requested by:
1  : ModuleManager.<init>(ModuleManager.java:105)
      \_ for 3rd parameter
     at AppInitializer.moduleManager(AppInitializer.java:37)
      \_ for field moduleManager
     while locating AppInitializer

Learn more:

this is a partion of ModuleManager.java where the bug is

  @Inject
  public ModuleManager(
      AuthService authService,
      MetaModuleRepository modules,
      ViewLoader viewLoader,
      ModelLoader modelLoader,
      I18nLoader i18nLoader,
      DataLoader dataLoader,
      DemoLoader demoLoader) {
    this.authService = authService;
    this.modules = modules;
    this.viewLoader = viewLoader;
    this.dataLoader = dataLoader;
    this.demoLoader = demoLoader;
    metaLoaders = ImmutableList.of(modelLoader, viewLoader, i18nLoader);
  }

and this is a portion of viewloader.java :


public abstract class ViewLoader extends AbstractParallelLoader {

  private static final Logger LOG = LoggerFactory.getLogger(ViewLoader.class);

  @Inject private ObjectMapper objectMapper;

  @Inject private MetaViewRepository views;

  @Inject private MetaSelectRepository selects;

  @Inject private MetaActionRepository actions;

  @Inject private MetaMenuRepository menus;

  @Inject private MetaActionMenuRepository actionMenus;

  @Inject private GroupRepository groups;

  @Inject private XMLViews.FinalViewGenerator finalViewGenerator;

  private final Set<String> viewsToGenerate = ConcurrentHashMap.newKeySet();
  private final Map<String, List<String>> viewsToMigrate = new ConcurrentHashMap<>();
  private final Map<String, List<Consumer<Group>>> groupsToCreate = new ConcurrentHashMap<>();

I hope this is enough as a source, I can't post all the code.
I don't know what the error means.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

慕巷 2025-02-19 04:03:18

ViewLoader是一个抽象类。 Guice只是说您需要提供可以实施的东西。 Guice无法实例化抽象类。因此,提供具有具体实现的绑定:

class MyViewLoader extends ViewLoader {
  // Implement abstract methods.
}

然后在模块中绑定实现:

  @Override public void configure() {
    bind(ViewLoader.class).to(MyViewLoader.class);
  }

ViewLoader is an abstract class. Guice simply says that you need to provide something it can instanciate. Guice can't instantiate abstract class. So provide a binding with a concrete implementation:

class MyViewLoader extends ViewLoader {
  // Implement abstract methods.
}

Then bind the implementation in your module:

  @Override public void configure() {
    bind(ViewLoader.class).to(MyViewLoader.class);
  }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文