Data persistency using BandanaManager stopped working with Bamboo 7

We are the maintainers of the Bamboo Artifactory Plugin.
While testing the plugin with Bamboo 7, we noticed that after the upgrade, the plugin code was no longer able to read or write its Artifactory servers configuration to the database.
The plugin is currently using Bandana Manager to do this.
We can also see that upon creation of a new server, the BandanaManager remains null.

We were looking for a code sample to achieve this, but couldn’t find any. Would you be able to share with us a code sample?
Appreciate your help!

Hi @BarBelity,

first, I’m not all that familiar with Bamboo App development. However, given that the platforms do not differ much, the likely cause is that you’re using Setter-Injection. This is no longer supported. Please use constructor injection instead.

1 Like

Thanks for replying!
Any change you can guide us towards a sample code that already does this? Alternatively, is there another open source Bamboo Plugin, that uses the Bamboo API to read and write configuration data from the database, and works with Bamboo 7?
Thank you for helping us with this.

Hi @eyalbe4,

I would have expected that you know the difference between Setter and Constructor based dependency injection. That means, instead of:

public void setBandanaManager(BandanaManager bandanaManager) {
//...
}

you’re using a constructor now:

public ServerConfigManager(BandanaManager bandanaManager) {
    this.bandanaManager = bandanaManager;
}

If you have classes with more dependencies, then add them to the constructor as well.

Hi, it was mentioned at Bamboo 7.0 EAP release notes, see Known issues section Bamboo 7.0 EAP 02 Release Notes | Bamboo Data Center and Server 9.1 | Atlassian Documentation

@dennis.fischer, @achystoprudov
The setter-injection was the problem (obviously), we missed it in the release-notes for Bamboo 7.
Thanks for your help!