A component plugin module defines a Java component which will be injected into the component system used by your plugin.
The details differ depending on whether you are writing a Plugins1 or Plugins2 plugin.
Components under Plugins1
A component in a Plugins1 plugin will be installed into JIRA's core component manager (PicoContainer).
This means it will be inherently "public", that is available to other plugins to have injected into them.
Note, however, that these other plugins have no way to declare their dependency on your plugin, and so they would just throw errors at runtime if your plugin is unavailable.
A new component is simple to define as follows:
This example here defines a component implementing UserService that is put into the PicoContainer to inject into any other plugin modules. If you include this component module in your plugin, then your other plugin modules can define a constructor with a UserService parameter and this implementation will be provided to your plugin module automatically.
These components allow you to simplify the creation and management of your plugin modules quite a lot.
Components under Plugins2
A component in a Plugins2 plugin will be installed into the Spring container for your plugin.
It will be "private" by default. This means classes in your plugin will be able to get that component dependency-injected, but other plugins will not.
However the component can be declared public, which allows other Plugins2 plugins to import a dependency on your component.
See the Plugins2 Component Plugin Module documentation for details.
Replacing core components considered harmful!
A number of plugin developers in the past used Plugins1 Components to replace/override core JIRA components.
This is not guaranteed to work, and can cause subtle problems that would be very difficult to trace even if it "appears" to work.
Additionally, the behaviour can change wildly from version to version because of changes in the startup order of components and component inter-dependencies.