Forums

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

ApplicationProperties applicationProperties returning null

Deleted user
October 11, 2018

Hey Guys,

I'm trying to get the base url for my Jira server instance using the application properties but i am having a bit of trouble. I am using the default code that was generated by the SDK but it doesn't seem to be working.  For more insight:

Import

import com.atlassian.sal.api.ApplicationProperties;

Class

public class Class implements Interface
{
@ComponentImport
private final ApplicationProperties applicationProperties;

 

Constructor

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

Code

public String getCurrentAppBaseUrl()
{
return applicationProperties.getBaseUrl(UrlMode.CANONICAL);
}

The above code returns null. Am i missing something? I even added the dependency in the pom.xml to be sure.

 

<dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<version>4.0.0-490c946</version>
<scope>provided</scope>
</dependency>

 

Any help is appreciated as I am on  a time crunch.

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 Champions.
October 11, 2018

Hello,

You miss the @Named annotation before class:

@Named
public class Class implements Interface
{
Deleted user
October 12, 2018

Hey @Alexey Matveev that is actually there. Everything that was generated by the SDK is in my current code

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events