Community Announcements have moved! To stay up to date, please join the new Community Announcements group today. Learn more
×Hi I am currently working on a custom plugin after upgrading from Jira 9 to Jira 10.3.2.
There are lot of changes which is exactly breaking the plugin flow.
I cannot do @ComponentImport on lots of objects(TemplateRenderer, ActiveObjects etc) from the osgi bundle into a classes such as
@Component
public class CustomPluginServlet extends HttpServlet {
@Inject
public CustomPluginServlet(@ComponentImport UserManager userManager) {
this.userManager = ComponentAccessor.getUserManager();
}
or in classes such as
@Path("/samplePath")
@Component
public class CustomConfigRestResource {
private final TransactionTemplate transactionTemplate;
@Inject
public CustomConfigRestResource(@ComponentImport TransactionTemplate transactionTemplate) {
this.transactionTemplate = transactionTemplate;
}
Is there a way to overcome this? Secondly I have a custom class in my plugin very similar to shown below.
Named
@ExportAsService({TransactionTemplate.class})
public class MyTransactionTemplate implements TransactionTemplate {
private ActiveObjects ao;
@Inject
public MyTransactionTemplate(@ComponentImport ActiveObjects ao) {
this.ao = ao;
}
@Override
public <T> T execute(TransactionCallback<T> action) {
return ao.executeInTransaction(() -> {
try {
return action.doInTransaction();
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}
}
How do I inject this in the class CustomPluginServlet shown above?