Replaces the alias key with a new ADI::AsAlias annotation
Accepts alias name as the first positional argument, or if not provided will try to infer it from the included interfaces (modules ending in Interface). If there is only 1, that type is used.
A string key may also be provided to alias other concrete services.
Re-organizes some of the specs to move them into where the logic is actually running
The use case for string keys is you can do something like this:
@[ADI::Register(name: "default_router")]
@[ADI::AsAlias("router")]
class Router
end
To have a service with an internal default_router id, but alias it to a more general router id. Then dependencies can be wired up to depend upon the "@router" implementation. This would allow users to in theory override the router alias to their own implementation (assuming it implements same API/interface(s)), and everything would just pick up on that w/o having to touch the original default_router. I could see this being useful at some point.
alias
key with a newADI::AsAlias
annotationInterface
). If there is only 1, that type is used.The use case for string keys is you can do something like this:
To have a service with an internal
default_router
id, but alias it to a more generalrouter
id. Then dependencies can be wired up to depend upon the"@router"
implementation. This would allow users to in theory override therouter
alias to their own implementation (assuming it implements same API/interface(s)), and everything would just pick up on that w/o having to touch the originaldefault_router
. I could see this being useful at some point.Resolves part of #385.