我正在尝试使用tutorial创建一个JIRA Listener,但是教程已经过时,我遇到了一个问题。插件构建,安装,但当我想注册Listener我正在
Class [com.example.tutorial.plugins.IssueCreatedResolvedListener] is not of type JiraListener.
我正在尝试在JIRA 6.4.13上执行此操作,但JIRA 7.x上的教程也会受到启用。
答案 0 :(得分:0)
最近的Jira版本使用了https://bitbucket.org/atlassian/atlassian-spring-scanner所述的Spring Scanner。一般来说,你应该:
所以,你的代码应该是这样的
@ExportAsService
@Component
@Named("IssueCreatedResolvedListener")
public class IssueCreatedResolvedListener implements InitializingBean, DisposableBean, LifecycleAware {
@ComponentImport
private final ApplicationProperties applicationProperties;
@ComponentImport
private final EventPublisher eventPublisher;
@ComponentImport
protected final LifecycleManager lifecycleManager;
@Inject
public IssueCreatedResolvedListener(final ApplicationProperties applicationProperties, final EventPublisher eventPublisher,
final LifecycleManager lifecycleManager) {
this.applicationProperties = applicationProperties;
this.eventPublisher = eventPublisher;
this.lifecycleManager = lifecycleManager;
}
@Override
public void afterPropertiesSet() {
eventPublisher.register(this);
}
@EventListener
public void onIssueEvent(IssueEvent issueEvent) {
...
}
...
}
希望这有帮助!