Giter Club home page Giter Club logo

Comments (4)

philipobenito avatar philipobenito commented on July 28, 2024

from container.

Messere avatar Messere commented on July 28, 2024

Basically I want some of the implementations for interfaces in application to be configurable by user. Application provides all the defaults, so it can run out of the box, but user can prepare yaml file which is parsed at startup and turned into appropriate definitions in the container.

I don't think I can have separate definitions. The rest of the application depends on autowiring so I need to use interface names as ids.

I can think of workarounds (split container initialization into multiple phases and provide default only if it wasn't configured by user, or provide defaults with new in constructors), but since the container already allows (at least partially) to modify definitions via setConcrete i thought I could use that. Unfortunately setConcrete leads to unexpected behaviour like described above.

from container.

philipobenito avatar philipobenito commented on July 28, 2024

Hi, it's not really designed to do that, the behaviour is expected as it's dealing with an existing definition, you'd be better having separate definitions and creating code to decide what alias it pulls from the container rather than messing with the container at runtime.

I'm gonna close this issue as what you're describing isn't really something that I'd plan to change, but happy to continue discussions.

from container.

Messere avatar Messere commented on July 28, 2024

Hi, that's ok.

I guess setConcrete was added for the purpose of providing test doubles rather than actually editing the container, and changing that would add unnecessary complexity to the library.

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.