Atlassian Spring Scanner injection problem when using JDK 8 Lambdas

Hello there,

this is my configuration:

JIRA version: 7.1.2

AMPS version: 6.2.4

JAVA version: 1.8.0_60 (project build path JRE system library [JavaSE-1.8])

QuickReload version: 1.30.2

When I am using in Injection annotated bean some features from JDK 8, like LocalDateTime as shown below, it is creating the bean an injecting dependencies correctly.

But when I try to use Lambda Expressions it fails with error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'importValidatorService': Injection of autowired dependencies failed;
No qualifying bean of type [com.example.service.IssueSearchService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.inject.Inject()}
@Named("issueSearchService")
public class IssueSearchService {

    private final SearchService searchService;
    private final JiraAuthenticationContext jiraAuthenticationContext;

    @Inject
    public IssueSearchService(@ComponentImport SearchService searchService,
            @ComponentImport JiraAuthenticationContext jiraAuthenticationContext) {

        this.searchService = searchService;
        this.jiraAuthenticationContext = jiraAuthenticationContext;
    }
 
private List<String> getIssueKeysFromIssueSearchResult(SearchResults searchResults) {

        List<String> issueKeys = new ArrayList<>();

        if (searchResults == null || CollectionUtils.isEmpty(searchResults.getIssues())) {
            return issueKeys;
        }



		// this is a part of JDK 8 API and it works!
        LocalDateTime timePoint = LocalDateTime.now();
        System.out.println(timePoint.getHour());


		// this is the old way
        for (Issue issue : searchResults.getIssues()) {
            issueKeys.add(issue.getKey());
        }


		// this is using stream and Lambda Expressions
		// NOT WORKING!!!
        issueKeys = issueKeys.stream().map(ik -> ik.getKey()).collect(Collectors.toList());

        return issueKeys;
    }

 

I saw couple of related questions and just one answer as it is resolved with atlassian-spring-scanner 1.2.7, but as you can see I am using even later version 1.30.2 and it is not working.

Also I saw that this is resolved in JIRA 7, but I am using JIRA 7.1.2 and it is not working.

1 answer

1 accepted

Sorry, my mistake, I was referring to QuickReload version: 1.30.2, but the problem was in my Atlassian Spring Scanner version 1.2.6.

Problem is solved with version 1.2.7 like explained here.

P.S. Current version is: 2.0.1

I took reference from here.

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Feb 15, 2018 in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

1,208 views 6 19
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot