Unable to work Custom Field Searcher

Hi, i’m trying to make my own custom field.

IT is work, but i’m trying to make a searcher for them but i’m unnable to do that.

this is my customfield type:

 <customfield-type  name="Prueba" i18n-name-key="jira-custom-field.name" key="admintextfield" class="com.inlogiq.plugins.jira.customfields.JiraCustomField">       
      <description>Solo para administradores</description>      
      <resource type="velocity" name="view" location="/templates/customfields/view.vm"/>
      <resource type="velocity" name="edit" location="/templates/customfields/edit2.vm"/>
      <resource type="velocity" name="xml" location="/templates/customfields/xml.vm"/>         
  </customfield-type>

this is my searcher on the xml:

  <customfield-searcher key="ExactTextSearcherBH" name="Exact Text Searcher BH" class="com.inlogiq.plugins.searcher.SearcherExactText">
    <!-- this element defines the valid custom field types for this searcher --> 
    <valid-customfield-type package="{myPluginKey}" key="admintextfield" />
  </customfield-searcher>

and this is my class

package com.inlogiq.plugins.searcher;

import com.atlassian.jira.issue.customfields.searchers.ExactTextSearcher;
import com.atlassian.jira.util.JiraComponentFactory;
import com.atlassian.jira.util.JiraComponentLocator;
import com.atlassian.jira.jql.operand.JqlOperandResolver;
import com.atlassian.jira.issue.customfields.searchers.transformer.CustomFieldInputHelper;
import com.atlassian.jira.web.FieldVisibilityManager;


public class SearcherExactText extends ExactTextSearcher {
	
	public SearcherExactText	(final JqlOperandResolver jqlOperandResolver,final CustomFieldInputHelper customFieldInputHelper,final FieldVisibilityManager fieldVisibilityManager ) {
        super(jqlOperandResolver,customFieldInputHelper,fieldVisibilityManager);
		}
	
}

i found this error on atlassian-jira.log

Exception when retrieving plugin module {myPluginKey}:ExactTextSearcherBH, disabling plugin {myPLuginKey}
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.inlogiq.plugins.searcher.SearcherExactText': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.atlassian.jira.jql.operand.JqlOperandResolver' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

Hi, i found the solution to this.

If you add the import:

import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;

and then make the constructor like that

    public SearcherExactText(@ComponentImport JqlOperandResolver jqlOperandResolver, @ComponentImport CustomFieldInputHelper customFieldInputHelper, @ComponentImport FieldVisibilityManager fieldVisibilityManager) {
		super(jqlOperandResolver, customFieldInputHelper, fieldVisibilityManager);
	} 

then this will solve the problem

3 Likes