Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

Autowired annotation #96

Open
2 tasks done
thejhh opened this issue Jul 26, 2023 · 1 comment
Open
2 tasks done

Autowired annotation #96

thejhh opened this issue Jul 26, 2023 · 1 comment

Comments

@thejhh
Copy link
Contributor

thejhh commented Jul 26, 2023

@Autowired Annotation: By employing this annotation, parameters, properties, and setters will be automatically wired based on their types. This will simplify dependency injection and improve code modularity.

Example

export class NorAgentApp {

    @useAutowired()
    public static async run (
        @autowired('args')
        args: readonly string[],
        @autowired('stateService')
        stateService ?: AgentStateService,
        @autowired('parsedArgs')
        parsedArgs ?: ParsedCommandArgumentObject,
        @autowired('destroyService')
        destroyService ?: DestroyService,
    ): Promise<CommandExitStatus> {
        console.log('Hello World');
    }
}

TODO

  • AutowireUtils
  • Implementation for method main function decorators

For further insights and references, please refer to the following resources:

@thejhh
Copy link
Contributor Author

thejhh commented Jul 26, 2023

This is not perfect but step forward.

thejhh pushed a commit that referenced this issue Jul 26, 2023
thejhh pushed a commit to heusalagroup/fi.hg.node that referenced this issue Jul 26, 2023
thejhh pushed a commit that referenced this issue Jul 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant