This feature implements "deferred" injection by allowing the @Inject() decorator to be used on fields and properties with set accessors. This will effectively allow "seamless" circular dependencies when they are needed, since properties and fields not defined in the constructor can be injected after the host class is instantiated.
Acceptance Criteria
To Discuss
- Is this a bad idea? E.g. will it enable/encourage bad practices?
- Are there cases when fields/properties will not be able to be set before exposing the instance to the consumer? If so, does the consumer need to be notified of when the values are available?
This feature implements "deferred" injection by allowing the
@Inject()decorator to be used on fields and properties withsetaccessors. This will effectively allow "seamless" circular dependencies when they are needed, since properties and fields not defined in the constructor can be injected after the host class is instantiated.Acceptance Criteria
@Inject()decorator is updated to be both a param and property decorator (note: hybrid decorators can be defined by using an intersection type of the decorator types -ParamDecorator & PropertyDecorator@Inject()throws an error when used on a property with nosetaccessorreadonlyfields - in this case,@Inject()should throw for those tooTo Discuss