Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-31413

Component injection does not work correctly for own implementation of customfield-searcher module type

    XMLWordPrintable

Details

    Description

      If you write your own CustomFieldSearcher and you would like to inject your own dependencies (components) to the constructor you will get UnsatisfiableDependenciesException.
      Additionally CustomFieldSearcher implementation class (provided by a plugin) is instantiated by JIRA in a different way while adding a custom field from admin UI and in a different way when the searcher is actually used.
      In one case the injection will work, but not in the other.

      The only workaround known to me at that time is to:

      • define you dependency as a public module (public to OSGi) in your plugin
      • do NOT attempt to inject it to your CustomFieldSearcher implementation constructor
      • instead in init(CustomField) method use ComponentAccessor.getOSGiComponentInstanceOfType(YourDependencyClass.class) and assign it to a field for future use.

      Obviously it should be fixed in JIRA core so that normal injections (of local modules) work fine.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              wseliga Wojtek Seliga (Inactive)
              Votes:
              8 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated: