Skip to content

Dependencies

dneumann edited this page Dec 12, 2017 · 4 revisions

In some of the previous images, you saw that the Solr importer optionally uses a project-specific plugin. Thus, the arrow went from the importer to the plugin. This direction of dependency is correct, but only at runtime. At compile time however, the direction is inverted, as shown in the next picture.

The first arrow from plugin to core functions means that the plugin can use any of the implemented functionalities like logging, accessing the environment, etc, in its own code. The second arrow shows a class extension. The dependency here is also directed from the child class to the parent class, since only the child "knows" in its code about the presence of the parent. In fact, the whole core functions component doesn't "know" anything about the plugin component.

This is called the Dependency Inversion Principle. This way, the Solr importer can be compiled on its own. Only at runtime does the importer find the plugin and loads its classes.

Clone this wiki locally