Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How do I stop spring from injecting Properties.class into my plugin?

We have a plugin that worked fine on Jira 7 but began failing to start on Jira 8.  I narrowed down the failure to a class that has a Properties.class being injected into it by Jira; presumably, by the Spring framework.  This application is designed to be agnostic of Jira and operate in a number of our tools.  For that reason, it does not import anything specific to Jira or any other tool.  It does not import the Spring framework, but still receives the false class being injected into it.

The usual way this class gets initialized is through it's own no-arg constructor, which calls private methods to send a Properties file that has been read off the file system, into a constructor which accepts the Properties file.

Roughly, the class is (It's the properties file in the second constructor that is being injected):

public ConfigClass() {

public ConfigClass(Properties config) {
    fieldVar1 = config.getProperty("blah");

Is it possible to stop the Properties file from being injected without having to import the spring framework?

It's written this way for improved test-ability, which I'm trying to preserve.  I've confirmed it works if I get rid of the constructor accepting the Properties.class and just initialize fully through the no-arg constructor, but this breaks most of it's tests because we then can't mock out the incoming properties.  At least not cleanly.



Log in or Sign up to comment

Atlassian Community Events