Spring scanner: Dependencies not resolved until server restart


I’m actually creating a BitBucket plugin, but I have the same problem with JIRA plugins.
I’m using the Atlassian Spring Scanner in the default plugin template. I have the problem, that newly injected dependencies will not be resolved until I restart the server completely. With the old component-import tags in atlassinan-plugin.xml, i was never running into this kind of problem. Issueing a simple “pi” in the atlas-cli made my plugin reload correctly. A similar error to this will be printed into the console:

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

I tried both Spring Scanner 1 and 2… I’ve been running into this kind of problem numerous times, and it’s becoming really frustrating to the team, we are considering to go back to the old tags in atlassian-plugin.xml

How to achieve this kind of hot reloading with Atlassian Spring Scanner? Is there any way to make it work reliable? Thanks for your answers in advance. :slight_smile:

In general, I have to say, that Atlassian Spring Scanner caused more problems for us, than it solved.

Using and leveraging spring scanner is a technique. It’s not just something you “do”, you must understand what is actually occurring during compilation. I have zero problems with it.

FastDev, pi, and atlas-cli are deprecated. Move to QuickReload. I suspect that will resolve your issues. https://developer.atlassian.com/docs/developer-tools/working-with-the-sdk/command-reference/atlas-cli

There is a high chance, that one of the manager you are using in java class file are not being referenced properly. That’s why you are facing this error. I am no expert at solving this. But taking a second look at java files or asking someone to take a look at those file will get you ahead in searching for resolution.