Following code stop working in spring-context 6.1.0.
```java @Bean public BeanA bean1 () { return new BeanA("a1"); }
@Bean
public BeanA bean2 () {
return new BeanA("a2");
}
@Bean
public BeanB bean3 (BeanA bean1) {
BeanB beanB = new BeanB(bean1);
return beanB;
}
Error: Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'com.example.BeanA' available: expected single matching bean but found 2: bean1,bean2
It was working fine until spring-context 6.0.14
[bean-method-parameters.zip](https://github.com/spring-projects/spring-framework/files/13465067/bean-method-parameters.zip)
Didn't find any related change here:
https://github.com/spring-projects/spring-framework/wiki/What's-New-in-Spring-Framework-6.x
**Comment From: bclozel**
Have you seen the second paragraph in the upgrade guide?
https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-6.x#core-container
You should have seen log messages as well with 6.0.x.
Can you try compiling with the "-parameters" option and let us know?
**Comment From: LogicBig**
@bclozel thanks.
I fixed the issue by adding following:
```xml
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>`
Also I see the warning logs in pre 6.0.14, never paid attention π
WARNING: Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead or avoid its introspection: com.example.InjectParameterByName$Config
Thanks!
Comment From: sbrannen
Thanks for the confirmation, @LogicBig.
Also I see the warning logs in pre 6.0.14, never paid attention π
Well, sometimes it pays to heed warnings. π
Comment From: sbrannen
This is effectively a duplicate of
-
31643