I have been trying to inject either the ComponentAccessor or EpicLinkManager into my constructor but run into some issues.
If I use EpicLinkManager in my constructor:
@Autowired
public MyWebworkModuleAction( @ComponentImport IssueService issueService, .....@ComponentImport EpicLinkManager epicLinkManager) {
after adding jira-greenhopper-plugin (6.7.4) from com.atlassian.jira.plugins to my pom.xml the atlas-run will compile and run it but the plugin will not be loaded (ie its web item is missing from the more menu).
If I use ComponentAccessor instead of the EpicLinkManager (to try to access EpicLinkManager over it) it hangs at atlas-run with a count down:
@Autowired
public MyWebworkModuleAction( @ComponentImport IssueService issueService, .....@ComponentImport ComponentAccessor componentAccessor) {
[INFO] [talledLocalContainer] 2017-11-29 09:21:34,689 localhost-startStop-1 INFO [c.a.plugin.util.WaitUntil] Plugins that have yet to be enabled: (2): [com.xyx.xyz, com.xyzxyz.xyz-tests], 12 seconds remaining
Even though I might have issues with the greenhopper one I would expect that the ComponentAccessor would load without issues considering its more frequent used. None of the other components (like IssueLinkManager or PageBuilderService) I am injecting has any issues, its just these so far.
Anyone any ideas? Thanks!
Hi Martin,
ComponentAccessor is mainly a static accessor which means you can import its package and simply use it like:
ProjectManager pm = ComponentAccessor.getProjectManager();
I guess you can therefore use:
EpicLinkManager elm = ComponetAccessor.getComponentOfType(EpicLinkManager.class);
Hope this helps!
Thanks Micky, it worked for the ComponentAccessor but still no go on getting an instance of the EpicLinkManager. I posted another question solely about the EpicLinkManager as I suspect I am messing up somewhere. https://community.atlassian.com/t5/Jira-Software-questions/How-do-I-create-a-EpicLinkManagerImpl-instance/qaq-p/681536
This one is answered for the ComponentAccessor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad to hear it helped, will try and give you some input in the other thread!
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Doing it this way in my SpringBoot application I always get an Exception that the ComponentAccessor is not initialized.
ComponentAccessor has not been initialised.
Can anybody tell me what I have to do that the ComponentAccessort will be properly initialized in a SpringBoot environment? Finally, I want to access the CustomFieldManager to work upon CustomFields...
...
customfieldMap.forEach((k, v) -> {
CustomFieldManager cfm = ComponentAccessor.getComponent(CustomFieldManager.class);
CustomField cf = cfm.getCustomFieldObjectByName(k);
System.out.println(cf.getValue((com.atlassian.jira.issue.Issue)v));
...
}
...
I get this exception even when I explicitely autowire the ComponentAccessor with
private ComponentAccessor componentAccessor;
public void setComponentAccessor(final ComponentAccessor componentAccessor) {
this.componentAccessor = componentAccessor;
}
...but the ComponentAccessor should be accessed in a static way anyway, shouldn't it!?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.