In Unified Modeling Language (UML) class diagrams, a dependency relationship indicates that a change to one class (the supplier) might cause a change in the other class (the client). The supplier is independent because a change in the consumer does not affect the supplier.
For example, a Cart class depends on a Product class because the Product class is used as a parameter for an add operation in the Cart class. In a class diagram, a dependency relationship points from the Cart class to the Product class. In other words, the Cart class is the consumer element, and the Product class is the supplier element. A change to the Product class may cause a change to the Cart class.
In UML class diagrams, dependency relationships in a Java™ application connect two classes to indicate that there is a connection between the two classes, and that the connection is more temporary than an association relationship. A dependency relationship indicates that the consumer class does one of the following things:
Enterprise JavaBeans™ (EJB) references are visualized as stereotyped dependency relationships.
As the following figure illustrates, a dependency relationship connector is displayed as a dashed line with an open arrow that points from the client class to the supplier class.
Java source code | UML visualization |
![]() |
![]() |