![](/img/trans.png)
[英]Guice/MissingImplementation]: No implementation for ActorRef<UserParentActor$Create> was bound
[英][Guice/MissingImplementation]: No implementation for ViewLoader was bound
運行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);
}
這是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<>();
我希望這足以作為來源,我不能發布所有代碼。 我不知道錯誤是什么意思。
ViewLoader
是一個抽象的 class。 Guice 只是說你需要提供一些它可以實例化的東西。 Guice 無法實例化抽象 class。 因此,提供具有具體實現的綁定:
class MyViewLoader extends ViewLoader {
// Implement abstract methods.
}
然后在你的模塊中綁定實現:
@Override public void configure() {
bind(ViewLoader.class).to(MyViewLoader.class);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.