As we develop the Atlasian plug-in, You will encounter the corresponding @Scanned annotations.
But, I don't know what @Scanned annotation does.
Does anyone know any documents to explain or refer to?
Hi @Junseok Lee
I found the following answer from an Atlassian Team member in another post:
@Scanned says, consider this class as part of something that the spring-scanner build time should consider (like @Component / @Inject but without any other side effects).
For the record "rest modules" are magic in that they do not need to make themselves known to Spring and yet are "wired" for you by the Atlassian plugin system. But @Scanned is needed here to make the spring-scanner build time take it into consideration.
In my own experience, i use @Scanned in classes that i extends other classes, for example:
@Scannedpublic class SettingsServlet extends HttpServlet
or
@Scanned@Namedpublic class IsPluginLicensedCondition extends AbstractWebCondition
In cases when you use @Scanned annotation to your class, you should use @Inject annotation to your constructor.
In other cases, when you use @Component, like:
@Componentpublic class CreateProjectRestResources
@Componentpublic class Utils
you should use @Autowired annotation to your constructor.
Wow! , Thank you so much.
Hi Everyone,
my situation is slightly different.
I have
@Named@ExportAsServicepublic class ENGSLAService extends AbstractService {@JiraImportprivate JqlQueryParser jqlQueryParser;@JiraImportprivate SearchService searchService;private InsightReader insightReader;@Injectpublic ENGSLAService(JqlQueryParser jqlQueryParser, SearchService searchService) {this.jqlQueryParser = jqlQueryParser;this.searchService = searchService;this.insightReader = ComponentAccessor.getOSGiComponentInstanceOfType(InsightReader.class);log.warn("insightReader is " + insightReader);} }
@JiraComponentpublic class InsightReader {@JiraImportprivate ObjectFacade objectFacade;@JiraImportprivate IQLFacade iqlFacade;}
but insightReader object is null after initialization in ENGSLAService's construction? What am I doing wrong? Did I mess up with the annotations?
Thanks for helping!
It looks like you're new here. Sign in or register to get started.