Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use correctly ApplicationProperties

lpopek September 17, 2018

Hello, 
I have properties file in resources folder in my Spring plugin project, named "my-field.properties" 

In my class I tried to return message from field description, but I getting null value. 

 

@Inject
protected ApplicationProperties applicationProperties;

{...}
protected String getStringError(){
return applicationProperties.getDefaultBackedText("my-field.properties.description");
}


Whats problem?

 

 

1 answer

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 17, 2018

Hello,

Here is what Jira generates by default

@ExportAsService ({MyPluginComponent.class})
@Named ("myPluginComponent")
public class MyPluginComponentImpl implements MyPluginComponent
{
@ComponentImport
private final ApplicationProperties applicationProperties;

@Inject
public MyPluginComponentImpl(final ApplicationProperties applicationProperties)
{
this.applicationProperties = applicationProperties;
}

public String getName()
{
if(null != applicationProperties)
{
return "myComponent:" + applicationProperties.getDisplayName();
}

return "myComponent";
}
}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events