Giter Club home page Giter Club logo

Comments (3)

philipobenito avatar philipobenito commented on July 28, 2024

The problem here is that the container doesn't know where to find the tag.

Are all definitions for that tag in the same service provider? If so, add the tag name to 'provides' and it will resolve it correctly.

If the definitions are spread across multiple service providers, that may not work as expected, so I'd suggest implementing the bootable service provider for those, and moving those particular definitions to the boot method.

I will give this a bit more attention when I have time as it's made me see the issue with spreading tagged definitions across multiple service providers.

Hope this helps and I will keep you updated.

from container.

Tabrisrp avatar Tabrisrp commented on July 28, 2024

Thank you for the fast answer!

The definitions are indeed spread into multiple service providers, as each service has multiple definitions, including one or more subscriber in the way the app is built right now.

I'm going to take a look at using the bootable service provider for the tagged definitions, this could be a good workaround for now.

from container.

philipobenito avatar philipobenito commented on July 28, 2024

The problem with them being spread, is that service providers are lazily loaded and the container determines what to register based on the alias requested... which works great in most cases, but, once it finds a service provider that 'provides' the requested alias, it stops at that one. But that obviously becomes a problem if it's a tag and there are more definitions in service providers that it won't reach.

This is something I'd not thought of before so thanks for the report, I'll solve it the as soon as I can.

The boot method of a bootable service provider is eagerly loaded, so that will solve your problem and you won't need to add the tag to 'provides', it's not necessarily a workaround as such, but being able to lazy load is obviously better.

from container.

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.