等效于匕首@COMPONENTSCAN?
抱歉,我要问的这个基本问题,但是有人可以告诉我匕首依赖注入是否可以与@module,@provides @inject等一起使用,而不用使用@component注释?
在春季DI中,我们使用@ComponentScan让Spring知道在哪里可以找到豆。匕首在匕首中等同于什么?
Sorry for this basic question I am asking but can someone tell me if dagger dependency injection can work just with @module, @provides @Inject etc. That is without using @component annotation?
In spring DI, we use @componentScan to let spring know where to find beans. What is the equivalent of this in dagger?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您始终需要@component。这是“外部”依赖关系的切入点。
当我说“外部”时,我的意思是在创建组件内的依赖关系图之后,现在是时候注入某些活动的时候了。因此,组件暴露了“外部”的依赖关系。
同时,组件可以与其他子组件共享其依赖关系。
组件取决于模块来知道如何创建依赖项。
You always need @Component. This is the entry point for dependencies from "outside".
When I say "outside" I mean the case where after the dependency graph inside the Component is created and now it is a time for some Activity to be Injected for example. So the component exposed dependencies for the "outside".
At the same time, a component can share its dependencies with other Subcomponents for example.
The Components depend on the Modules to know how to create dependencies.