Skip to content

When to avoid dependency injection #1

@120318

Description

@120318

Sometimes, when there are a lot of embedded dependencies (if your dependencies have their own dependencies), initialization can be a nightmare.

I very much agree with this, I want to know when I should inject dependencies and when I don't need them.
My current practice is that if the dependency is a toolkit or a stateless method, I would choose to use the global method directly or choose to initialize it internally.
Do you have any good suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions