How to implement a searcher for a custom field plugin?

I have implemented a custom field plugin for Jira based on the CalculatedCFType class. The plugin returns Group values. Now I would like to make the custom field searchable. The GroupPickerSearcher class seems to be the correct searcher for this field type.

I have tried adding the following lines to atlassian-plugin.xml:

<customfield-searcher name="Group Picker Searcher" i18n-name-key="admin.customfield.searcher.grouppickersearcher.name" 
   key="com.atlassian.jira.plugin.system.customfieldtypes:grouppickersearcher" class="com.atlassian.jira.issue.customfields.searchers.GroupPickerSearcher">
   <description key="admin.customfield.searcher.grouppickersearcher.description">Allows to search for group using a group picker.</description>
   <resource type="velocity" name="label" location="templates/plugins/fields/view-searcher/label-searcher-group.vm"/>
   <resource type="velocity" name="search" location="templates/plugins/fields/edit-searcher/search-grouppicker.vm"/>
   <resource type="velocity" name="view" location="templates/plugins/fields/view-searcher/view-searcher-grouppicker.vm"/>
   <valid-customfield-type package="${atlassian.plugin.key}" key="my-reportercustomergroups"/>
</customfield-searcher>

But when running a Jira test instance an initialization error is logged:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.atlassian.jira.issue.customfields.searchers.GroupPickerSearcher': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'com.atlassian.jira.issue.customfields.converters.GroupConverter' available: expected single matching bean but found 2: groupConverter,multiGroupConverter

How can I qualify the bean class? A possible solution might be to add an own class CustomGroupPickerSearcher that extends the GroupPickerSearcher class. But then I still have problems to provide implementations for the parent constructor arguments.

1 Like