Issue #8229 by tuj: Refactor injection pattern