Hello,
I'm trying to implement a plugin with a custom field type for DateTime. But I always get an error message that the module is broken.
My code:
import com.atlassian.jira.config.properties.ApplicationProperties;
import com.atlassian.jira.datetime.DateTimeFormatterFactory;
import com.atlassian.jira.issue.customfields.impl.DateTimeCFType;
import com.atlassian.jira.issue.customfields.impl.FieldValidationException;
import com.atlassian.jira.issue.customfields.manager.GenericConfigManager;
import com.atlassian.jira.issue.customfields.persistence.CustomFieldValuePersister;
import com.atlassian.jira.issue.history.DateTimeFieldChangeLogHelper;
import com.atlassian.jira.security.JiraAuthenticationContext;
import com.atlassian.plugin.spring.scanner.annotation.component.Scanned;
import com.atlassian.plugin.spring.scanner.annotation.imports.JiraImport;
@Scanned
public class DateTimeField extends DateTimeCFType {
public DateTimeField(
@JiraImport CustomFieldValuePersister customFieldValuePersister,
@JiraImport GenericConfigManager genericConfigManager,
@JiraImport DateTimeFormatterFactory dateTimeFormatterFactory,
@JiraImport JiraAuthenticationContext jiraAuthenticationContext,
@JiraImport ApplicationProperties applicationProperties,
@JiraImport DateTimeFieldChangeLogHelper dateTimeFieldChangeLogHelper) {
super(customFieldValuePersister, genericConfigManager, dateTimeFormatterFactory, jiraAuthenticationContext, applicationProperties, dateTimeFieldChangeLogHelper);
}
}
atlassian-plugin.xml
<customfield-type name="DateTimeField" i18n-name-key="DateTimeField" key="date-time-field" class="com.jira.plugins.fields.DateTimeField">
<description>DateTimeField</description>
<resource type="velocity" name="view" location="templates/plugins/fields/view/view-datetime.vm"/>
<resource type="velocity" name="edit" location="templates/plugins/fields/edit/edit-datepicker.vm"/>
<resource type="velocity" name="xml" location="templates/plugins/fields/xml/xml-datetime.vm"/>
</customfield-type>
I have solved it myself.
This line
@JiraImport ApplicationProperties applicationProperties,
@JiraImport("jiraApplicationProperties") ApplicationProperties applicationProperties,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Barney Dalton,
this determines that the implementation "JiraApplicationProperties" is to be used.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The field type is also not selectable when creating a custom field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Welcome to the Atlassian Community!
What errors are you seeing in the logs?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Nic Brough,
this is what I found in the logs:
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.jira.plugins.fields.DateTimeField': Unsatisfied dependency expressed through constructor parameter 4; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.atlassian.jira.config.properties.ApplicationProperties' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@com.atlassian.plugin.spring.scanner.annotation.imports.JiraImport(value="")}
io.atlassian.util.concurrent.LazyReference$InitializationException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.jira.plugins.fields.DateTimeField': Unsatisfied dependency expressed through constructor parameter 4; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.atlassian.jira.config.properties.ApplicationProperties' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@com.atlassian.plugin.spring.scanner.annotation.imports.JiraImport(value="")}
Thanks in advance!
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.