Giter VIP home page Giter VIP logo

Comments (4)

bcorso avatar bcorso commented on June 12, 2024 1

Why is it bound by @Component.modules in ChildScope if the @Provides @ParentScoped has different scope from the component?

By adding a module to @Component.modules() it means every @Provides/@Binds method in that module is installed in that component. There's no way to tell Dagger to only install certain @Provides methods and not others.

Doesn't docs say components cant have differently scoped providers in them?

That's correct. Normally, if you try to install a module in a component and one of its @Provides methods has the wrong scope then Dagger will report an error about it. I think the only reason you aren't seeing that here is because Dagger checks for duplicate bindings first, so it's reporting that error instead.

from dagger.

bcorso avatar bcorso commented on June 12, 2024

i want to group stuff together by functionality in modules throughout cross-cutting concerns components from different level of scoping. Is there an alternative way of doing it without requiring me to split into module-per-scope?

No, you will need to split the provides methods into two separate modules.

is there a simple explanation why is String a being bound multiple times? I didn't bind it anywhere in ChildScope.

It's bound once via the @Component.modules = SharedModule.class and again via the @Component.dependencies = ParentScope.class.

from dagger.

macabrus avatar macabrus commented on June 12, 2024

Why is it bound by @Component.modules in ChildScope if the @Provides @ParentScoped has different scope from the component? Doesn't docs say components cant have differently scoped providers in them? It should probably try to use binding from parent if scope doesn't match, no?

from dagger.

macabrus avatar macabrus commented on June 12, 2024

Thanks for the insightful comment. Appreciate it. I'll use separate modules then 😁

from dagger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.