Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Qualifier-Annotation not working in combination with AutomaticJobRegistrar [BATCH-2303] #1300

Closed
spring-projects-issues opened this issue Sep 13, 2014 · 1 comment
Labels
in: core status: invalid Legacy label from JIRA. Superseded by "status: declined" type: bug

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Sep 13, 2014

Dennis Schulte opened BATCH-2303 and commented

It seems there is a bug when I want to use the @Qualifier-Annotation in combination with the AutomaticJobRegistrar. Autowiring without Qualifiers is fully working. The problem is that Spring doesn't find the referenced bean "subExampleService" that is annotated with @Qualifier inside the "exampleService"-Bean.

XML-Snippet:

<bean id="exampleService" class="de.codecentric.batch.item.ExampleService"/>
<bean id="subExampleService" class="de.codecentric.batch.item.SubExampleService"/>

Java-Snippet:

public class ExampleService {

    @Autowired
    @Qualifier("subExampleService")
    SubExampleService subExampleService;
    
    public String echo(String echo){
    	return subExampleService.echo(echo);
    }

}

I've added an example project with a test case "ApplicationTests" which produces the exception: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'subExampleService' is defined


Affects: 3.0.1

Reference URL: https://github.com/codecentric/spring-samples/tree/master/batch-simple

@fmbenhassine
Copy link
Contributor

@denschu Thank you for sharing a minimal example that reproduces the problem! However, this is not a Spring Batch issue. Without any code modification, the same test passes by upgrading Spring Framework from 4.0.6 to 4.0.8 here: https://github.com/codecentric/spring-samples/blob/master/batch-simple/pom.xml#L11

Looking at the change log of Spring Framework v4.0.8, I see in the "Bug Fixes" section that this was indeed resolved in spring-projects/spring-framework#16805.

@fmbenhassine fmbenhassine removed the status: waiting-for-triage Issues that we did not analyse yet label Jan 21, 2020
@fmbenhassine fmbenhassine added the status: invalid Legacy label from JIRA. Superseded by "status: declined" label Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core status: invalid Legacy label from JIRA. Superseded by "status: declined" type: bug
Projects
None yet
Development

No branches or pull requests

2 participants