Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with dependency injection in custom plugins in Jira 10

Ravi Saurav
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 26, 2025

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?

0 answers

Suggest an answer

Log in or Sign up to answer