Hello,
I'm trying to follow the custom field type tutorial: https://developer.atlassian.com/jiradev/jira-platform/guides/fields/tutorial-creating-a-custom-field-type
I have found that there are some discrepancies between the process detailde in the tutorial and the actual process, one of them being the reference to a com.atlassian.jira.plugin.customfield.example package, whereas the sdk creates com.atlassian.jira.plugin.customfield.example.api and com.atlassian.jira.plugin.customfield.example.impl packages.
Anyway, I'm sticking to the steps described in the tutorial, but when I cannot see my custom field type anywhere on my local JIRA instance.
The command line window keeps throwing these errors:
[INFO] [talledLocalContainer] com.atlassian.util.concurrent.LazyReference$InitializationException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.atlassian.jira.plugin.customfield.example.JiraCustomField': Unsatisfied dependency expressed through constructor argument with index 0 of type [com.atlassian.jira.issue.customfields.persistence.CustomFieldValuePersister]: : No qualifying bean of type [com.atlassian.jira.issue.customfields.persistence.CustomFieldValuePersister] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.jira.issue.customfields.persistence.CustomFieldValuePersister] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
which I can't seem to be able to fix adding
<component-import key="customFieldValuePersister" interface="com.atlassian.jira.issue.customfields.persistence.CustomFieldValuePersister"/>
to my atlassian-plugin.xml, as descriibed here: https://developer.atlassian.com/docs/faq/troubleshooting/unsatisfieddependencyexception-error-creating-bean-with-name
I'd appreciate any help on the subject.
Regards,
Community moderators have prevented the ability to post new answers.
There's something strange - to me - going on with spring scanner 1.2.6 with the JIRA 7.X series. From spring scanner's documentation, I see that they are upgrading to version 2.0 to use with JIRA 7.2.
At any rate, here is what to do: do not rely on constructor based injection. I don't know why. Instead, use property injection. So for example, adapt the custom field tutorial to be as follows (updated code to remove deprecation warnings):
import com.atlassian.plugin.spring.scanner.annotation.component.Scanned; import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport; @Scanned public class IntegerCFType extends GenericTextCFType { private static final Logger log = LoggerFactory.getLogger(IntegerCFType.class); @ComponentImport private final CustomFieldValuePersister customFieldValuePersister; @ComponentImport private final GenericConfigManager genericConfigManager; @ComponentImport private final TextFieldCharacterLengthValidator textFieldCharacterLengthValidator; @ComponentImport private final JiraAuthenticationContext jiraAuthenticationContext; public IntegerCFType(CustomFieldValuePersister customFieldValuePersister, GenericConfigManager genericConfigManager, TextFieldCharacterLengthValidator textFieldCharacterLengthValidator, JiraAuthenticationContext jiraAuthenticationContext) { super(customFieldValuePersister, genericConfigManager, textFieldCharacterLengthValidator, jiraAuthenticationContext); this.customFieldValuePersister = customFieldValuePersister; this.genericConfigManager = genericConfigManager; this.textFieldCharacterLengthValidator = textFieldCharacterLengthValidator; this.jiraAuthenticationContext = jiraAuthenticationContext; }
You should not need to add anything to atlassian-plugin.xml with this approach; we are using annotations instead.
This worked. Thank you so much. And, we still need the customfield-type entry in atlassian-plugin.xml as well
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.
Great! I tried to resolve this trouble for many days and I've read many answers, but only this solution helps me. Thanks!
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.
Please refer to this document that explains necessary changes coming with version 2.0.0 of atlassian-spring-scanner:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am still facing the same issue and none of the workarounds mentioned in Atlassian documentation seem to work. Any proper solution to this or will it be fixed going ahead?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to remove spring-scanner dependencies from your pom.xml.
It worked for me....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I'm having the same issue. CustomFieldValuePersisted is imported as a component-import in the atlassian-plugin.xml. It doesn't work for me with sdk v5.0.13 neither with 6.1.0. Any advise?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi there, i'm having the same issue, not sure how can I fix it. Any idea?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I ended up just using a previous version of the SDK (5.0.13) and it worked. https://marketplace.atlassian.com/plugins/atlassian-plugin-sdk-windows/versions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm running into the same situation. Were you able to resolve this? -Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.