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:
@Scanned
public class SettingsServlet extends HttpServlet
or
@Scanned
@Named
public 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:
@Component
public class CreateProjectRestResources
or
@Component
public class Utils
you should use @Autowired annotation to your constructor.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Everyone,
my situation is slightly different.
I have
@Named
@ExportAsService
public class ENGSLAService extends AbstractService {
@JiraImport
private JqlQueryParser jqlQueryParser;
@JiraImport
private SearchService searchService;
private InsightReader insightReader;
@Inject
public ENGSLAService(JqlQueryParser jqlQueryParser, SearchService searchService) {
this.jqlQueryParser = jqlQueryParser;
this.searchService = searchService;
this.insightReader = ComponentAccessor.getOSGiComponentInstanceOfType(InsightReader.class);
log.warn("insightReader is " + insightReader);
}
}
@JiraComponent
public class InsightReader {
@JiraImport
private ObjectFacade objectFacade;
@JiraImport
private 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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.