Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Jira Server/Data Center app: How to add an OOB condition to the web-item module in spring scanner

In this article I will show you how you can add an out of the box Jira condition to a web-item in a Jira Server/Data Center app which uses spring scanner.

You will not have this problem if you do not use spring scanner, but you will if you use. And I will show you two ways how to solve this problem.


I created a Jira Server/Data Center app.

Then I added a new web-item in the atlassian-plugin.xml

<web-item name="my-web-item" i18n-name-key="" key="my--web--item" section="operations-operations" weight="1000">
<description key="my--web--item.description">The my-web-item Plugin</description>
<label key="my--web--item.label"></label>
<condition class="com.atlassian.jira.plugin.webfragment.conditions.IsAdminCondition"/>
<link linkId="my--web--item-link"></link>

This code means that I want to have my-web-item in the view issue screen in the More menu:

Screenshot 2020-09-11 at 19.06.23.png

And also I added a condition to show it only for admins. Here is this line in the atlassian-plugin.xml file:

<condition class="com.atlassian.jira.plugin.webfragment.conditions.IsAdminCondition"/>

You can find the complete code for this part here.

Let's run our app.

And we will see that our app is not installed with the following error:

Caused by: java.lang.ClassNotFoundException: com.atlassian.jira.plugin.webfragment.conditions.IsAdminCondition not found by ru.matveev.alexey.atlassian.jira.condition.tutorial.jira-springscanner-webitem-condition-tutorial [231]

Ok. Let's fix it.

Fix ClassNotFoundException

To fix this error we need to add the com.atlassian.jira.plugin.webfragment.conditions package to the import-package in the pom.xml file.

Now our import-package looks like this:


Now let's run our app again.

And we will see another error:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type '' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

It means that the condition class could not inject required beans.

We can fix this error with two methods: add a bean which will imports required beans and use osgi:reference to import required beans.

Method 1: Add a bean which imports required beans

The required beans for our condition are JiraAuthenticationContext and GlobalPermissionService.

That is why I will create src/main/java/ru/matveev/alexey/atlassian/jira/condition/tutorial/impl/

public class BeanInjecter {

public BeanInjecter(@ComponentImport JiraAuthenticationContext jiraAuthenticationContext,
@ComponentImport GlobalPermissionManager globalPermissionManager) {


This bean just injects required beans and it will make those beans visible for our condition as well.

You can find the complete code for this part here.

Now run the app and everything will work.

Method 2: osgi:reference

Another method to use osgi:reference in src/main/resources/META-INF/spring/plugin-context.xml.

I deleted the file which I created earlier.

I added to import-package in pom.xml.

Then I changed src/main/resources/META-INF/spring/plugin-context.xml to the following code:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
<osgi:reference id="globalPermissionManager"

<osgi:reference id="jiraAuthenticationContext"


What I changed there?

I added xmlns:osgi="" and to be able to work with osgi:reference tag. And then I added two osgi:reference tags to import required beans:

 <osgi:reference id="globalPermissionManager"

<osgi:reference id="jiraAuthenticationContext"

That is all.

You can find the complete code for this part here.

Let's run the app and everything works as expected!

1 comment

Mohammed Amine Community Leader Jun 04, 2021

Great article


Log in or Sign up to comment
Community showcase
Published in Marketplace Apps & Integrations

Jira issue check and more advanced commit verifications for Bitbucket DC

Pre-receive hooks that verify the Git commit message, the modified files, and implement similar code change controls used to be requirements of large enterprises working in regulated industries only....

55 views 0 3
Read article

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