This documentation relates to the latest version of JIRA 4.0
If you are using an earlier version, please view the previous versions of the JIRA documentation and select the relevant version.

Component Plugin Module

Introduction

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 there 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:

<component key="userService" name="User Service" 
    class="com.atlassian.jira.rpc.soap.UserServiceImpl">
    <interface>com.atlassian.jira.rpc.soap.UserService</interface>
</component>

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.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Mar 14, 2008

    Matt Doar says:

    The Subversion plugin is a good example of a plugin that uses a component module...

    The Subversion plugin is a good example of a plugin that uses a component module.

    p.s. there's a typo in the word constructor

  2. Feb 19

    Jeff Kirby says:

    In Jira 3.13 we developed quite a few plugins that altered behaviour in Jira by ...

    In Jira 3.13 we developed quite a few plugins that altered behaviour in Jira by overriding an existing Jira component using a 'component' plugin module. We've done this with about a dozen components.

    I'm working now on migrating to Jira 4. The first plugin I tried to migrate was one that I wrote so that the user picker would find users using their initials in addition to partial name matches.

    To do that before I had injected a new UserPickerSearchService to replace the DefaultUserPickerSearchService. It worked great in Jira 3.13.
    I modified the code to compile in Jira 4 and fired it up. I can see that my code is loaded but it isn't getting called.

    Has the ability to override Jira components been reduced? I see a brief mention of it here.
    The only solution I can see now is replacing the DefaultUserPickerSearchService.class file with mine and abandoning the plugin approach which seems like a less than elegant solution.