-
Notifications
You must be signed in to change notification settings - Fork 72
Closed
Labels
Description
Currently we can register few definitions with different tags and one with no tag, which will be used as a default if we try to resolve component using unknown tag.
But it does not work the other way - if we don't register definition without tag we will not be able to resolve component without providing tag.
Would it be useful to be able to setup definition with tag as a default and later be able to resolve it without setting tag?
container.register(tag: "facebook", useByDefault: true) { FacebookOAuth() as OAuth }
container.register(tag: "twitter") { TwitterOAuth() as OAuth }
container.register(tag: "google") { GoogleOAuth() as OAuth }
container.resolve() as OAuth // will resolve FacebookOAuth
container.register() { TwitterOAuth() as OAuth } // will override previous default
container.resolve("tumblr") as OAuth // should not resolve, because user explicitly specified unknown tag