Hello
I want to get saved filter by it’s id in java
I tried to add SavedFilterService as dependency in the constructor of the listener, however it is giving me this error:
used by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.atlassian.greenhopper.service.rapid.SavedFilterService’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
I tried also to add @ComponentImport above the variable, however it prevented plugin from being uploaded
Any idea what’s the problem or any other alternative on how to get saved filter by id in jira (java)
Thanks in advance
In order to get saved filter by id you can use SearchRequestManager like this (not tested):
package my.package;
import com.atlassian.jira.issue.search.SearchRequest;
import com.atlassian.jira.issue.search.SearchRequestManager;
import com.atlassian.plugin.spring.scanner.annotation.imports.JiraImport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class JqlFilterService {
@JiraImport
private final SearchRequestManager searchRequestManager;
@Autowired
public JqlFilterService(SearchRequestManager searchRequestManager) {
this.searchRequestManager = searchRequestManager;
}
SearchRequest getFilter(Long filterId) {
return searchRequestManager.getSearchRequestById(filterId);
}
}
1 Like