We recently upgraded org.springframework.boot:* from 3.1.5 to 3.2.0 and observed failures in creation of below bean:

@Bean
public Job myJob(JobRepository jobRepository, Step preProcessStep, Step processStep, Step postProcessStep) {
    return new JobBuilder("myJob", jobRepository)
            .start(preProcessStep)
            .next(processStep)
            .next(postProcessStep)
            .build();
}

Failure Message:

Parameter 1 of method myJob in com.my.package.MyJobConfig required a single bean, but 3 were found:
  - preProcessStep: defined by method 'preProcessStep' in class path resource [com/my/package/configuration/MyJobConfig.class]
  - processStep: defined by method 'processStep' in class path resource [com/my/package/configuration/MyJobConfig.class]
  - postProcessStep: defined by method 'postProcessStep' in class path resource [com/my/package/configuration/MyJobConfig.class]

With upgrade to spring boot 3.2.0 the parameter name is no longer considered as default qualifier for dependency injection.

While this can be worked around by explicitly defining a qualifier as shown below but this would mean review of all configurations and autowired dependencies where multiple beans of same interface are created. Is this change intentional or we have broken this behavior in 3.2.0?

Work Around:

@Bean
public Job myJob(JobRepository jobRepository, @Qualifier("preProcessStep") Step preProcessStep, @Qualifier("processStep") Step processStep, @Qualifier("postProcessStep") Step postProcessStep) {
    return new JobBuilder("myJob", jobRepository)
            .start(preProcessStep)
            .next(processStep)
            .next(postProcessStep)
            .build();
}

Comment From: bclozel

I think this is due to https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes#parameter-name-discovery

You should have gotten WARN logs with Spring Boot 3.1.x about this. Please compile your code with the -parameters compiler option. See also https://github.com/spring-projects/spring-framework/issues/31675