Atlassian spring scanner DI not injecting to webwork constructor

Erko Knoll July 8, 2018

Hi,

I have a really weird bug on my hands. I have internal component and I can successfully inject it into other components. However if I try to inject it into web action constructor (extended by JiraWebActionSupport), it will throw "UnsatisfiedDependencyException: Error creating bean with name". Complaining it cannot find the bean, while elsewhere the same bean was successfully injected.

It is weird as in another plugin I'm doing the very exact pattern and there it works and I can't seem to figure out whats the difference.

I also managed to make it work through some complicated steps (removing OSGI service dependencies on another plugin and changing installation order), but as soon as I restart JIRA the problem is back, so whatever those steps did they are only temporary.

As a workaround I'm injecting those beans that cannot be injected directly into another component where I'm storing their references statically so I could access those static references in webwork classes. Really defeats the purpose of DI.


Spring scanner version: 1.2.13

1 answer

0 votes
Alexey Dorofeev _Rocktronic_ February 11, 2022

Faced the same problem. It turned out that the reason was that I used one WebWork action implementation class for several actions in atlassian-plugin.xml. The problem was solved by making a separate implementation for each action. Each implementation in this case is just an empty class that extends the original class.

Suggest an answer

Log in or Sign up to answer