anonymous. The old way to do things was to put the <component-import> in your atlassian-plugin.xml . A new way, and it is also recommended to use the Atlassian Spring Scanner . When you create an add-in using atlas-jira-create-plugin , and your pom.xml has the <Atlassian-Plugin-Key> and the atlassian-spring-scanner-annotation and atlassian-spring-scanner-runtime dependencies, then you use the new way.
If you have two dependencies, you are using Atlassian Spring Scanner version 1.x. If you only have atlassian-spring-scanner-annotation , you are using version 2.x.
You do not need to skip / comment on Atlassian-Plugin-Key in pom.xml , and you do not need to embed component-import in atlassian-plugin.xml .
For example, you want to add a license for your add-on and import the PluginLicenseManager component. You just go straight to the code, and your constructor might look like this:
@Autowired public MyMacro(@ComponentImport PluginLicenseManager licenseManager) { this.licenseManager = licenseManager; }
And your class looks like this:
@Scanned public class MyMacro implements Macro {
If memory suits me, be sure to check for null , because sometimes the Atlassian Spring Scanner cannot insert a component. I think in version 1, by writing @EventListener , he was unable to enter a ConversionContext . But when writing the macro, he was able to introduce a ConversionContext .
source share