How do I show Dependency Injection of an object or class in a UML class diagram?
2 Answers
Martin Fowler shows it like this:

5 Comments
Abdull
For anyone still curious how this notation is supposed to be interpreted: With the arrow pointing from
A to B, then this means A gets injected with a B. (One could also say B is injected into A)... So with the given example, MovieLister gets injected with a MovieFinder. (One could also say MovieFinder is injected into MovieLister)mLstudent33
Re: the "assembler" in the diagram. "In the Spring framework, the IoC container is represented by the interface ApplicationContext. The Spring container is responsible for instantiating, configuring and assembling objects known as beans, as well as managing their lifecycle." from baeldung.com/…
kudlatiger
what is assembler here?
clapas
@kudlatiger The Assembler is the one creating the proper instance of MovieFinder and then injecting it into the MovieLister.
emrich
I don't get why the bottom most arrow points from Assembler to MovieLister. Shouldn't the arrow point in the opposite direction? Doesn't MovieLister look up the injected Implementation for MovieFinder at the Assembler when MovieLister gets constructed?