1

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?

Akash Chauhan
  • 232
  • 1
  • 8

1 Answers1

0

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.

Yavor Mitev
  • 1,363
  • 1
  • 10
  • 22