Plugins - The plugin mechanism is at your fingertips


insert image description here


Pre

Plug-in - a configuration, only one step away from the plug-in mechanism Is there any dependency in it, I don't want to depend on it, what should I do?

insert image description here


plan

  1. Application A defines the service interface, and agrees on the functional specification implemented by the plug-in.
  2. Applications B, C, D, etc. implement the interface respectively, and package them into jar packages, and place them in the reading directory agreed by application A.
  3. When application A is running, it reads the jar package in this directory, and loads the implementation class in the jar package through reflection.
  4. Application A calls the method of the implementation class to complete the respective function extensions.

flow chart

Guess you like

Origin blog.csdn.net/yangshangwei/article/details/131296216