It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to inject/"Spring power" JIRA components using a standard Spring DM configuration

I'm working with a plugin that we are converting from dependency injection using an atlassian-plugin.xml configuration, to using a standard Spring DM configuration.


In other words, we are switching out these:

<component> / <component-import> / <module-type>


With an annotation based Spring-scanner and class annotations:


xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

<context:component-scan base-package=""/>

import com.atlassian.activeobjects.external.ActiveObjects;


public class MyClass
public MyClass(ActiveObjects ao, GroupManager gm) {
//Do something with ActiveObjects etc..



The issue is that I cannot figure out how to inject the standard Jira API/Core classes using Spring, as illustrated in the class definition above. Both injected classes above gives an NoSuchBeanDefinitionException.


Does anyone know how to properly set up Spring to look for beans not found in the namespace of my own plugin?


FYI: I am trying to avoid using the Atlassian Spring Scanner 2 library due to it's limitations related to configuring Spring profiles. 


1 answer

1 accepted

So, I believe I found a solution to the issue of injecting JIRA-components when using a pure Spring 5 XML configuration. The trick was in using the <osgi:reference>-tag (more info).


Example class:

package no.resight.powercatch.pcpluginupdater.startupbeans;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

public class SpringTestBean {

private final GroupManager groupManager;
private final ApplicationProperties applicationProperties;

public SpringTestBean(GroupManager groupManager, ApplicationProperties applicationProperties) {
this.groupManager = groupManager;
this.applicationProperties = applicationProperties;
System.out.println("HELLO FROM SPRINGTESTBEAN");

Example configuration: 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

<osgi:reference id="groupManager" interface=""/>
<osgi:reference id="applicationProperties" interface=""/>

<context:component-scan base-package="no.resight.powercatch.pcpluginupdater"/>


Things to note:

  • In the XML configuration example above, notice that the <osgi:reference>-tags point to the interface implementing the class we want to load - not the class itself.
  • Also, note osgi additions to the xsl:schemalocation and xmlns:osgi declarations in the header of the XML.

Hope that helps someone!



Is it turns out, Spring DM is in fact deprecated in favour of Gemini Blueprint. GB is the direct successor of DM, and the documentation can largely be shared between them. The only change required to use GB is to simplify the XML in the example above:


<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns=""

<!-- Any Jira interface that should be used for dependency injection must be declared here (this loosely replaces the legacy <component-import> statement) -->
<reference id="groupManager" interface=""/>

<!-- Scan the given package for bean declarations and annotations (@Component, @Autowire, etc.) -->
<context:component-scan base-package=""/>



Hi Tormod Haugene.
Don't you have any skeleton for jira plugin project based on Spring? Could you please share it?
I've spent a lot of time, but still not able to create it :( 
Many thanks in advance!

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

247 views 1 2
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you