Affects: \
I encountered an issue where method parameter beans are not injected correctly after upgrading from Spring Boot 2.7.18 to 3.3.2
Error creating bean with name 'androidEngineV3' defined in class path resource [xx/xx/brick/engine/android/AndroidEngineAutoConfiguration.class]: Unsatisfied dependency expressed through method 'androidEngineV3' parameter 0: No qualifying bean of type 'xx.xx.brick.parser.token.TokenIdService' available: expected single matching bean but found 2: defaultTokenIdService,compressTokenIdService
@Bean
@ConditionalOnMissingBean(name = "androidEngineV3")
public DeviceEngine androidEngineV3(TokenIdService defaultTokenIdService,
....) {
AndroidEngine androidEngineV3 = new AndroidEngine();
....
return androidEngineV3;
}
Everything worked fine with Spring Boot 2.7.18 and Spring 5.3.x, but after the upgrade, I am experiencing issues with dependency injection. Could you please help me with this problem? Thank you When I use @Qualifier, the issue is resolved, but making this change would require modifying too much code.
Comment From: snicoll
Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use the issue tracker only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.
Comment From: sbrannen
Hi @funky-eyes,
It looks like you might not be compiling your code with the -parameters
flag.
Please see the Parameter Name Retention notes in the Wiki for details.
If that solves the issue for you, it would be nice if you posted a comment here to confirm that.
Cheers,
Sam
Comment From: funky-eyes
Hi @funky-eyes,
It looks like you might not be compiling your code with the
-parameters
flag.Please see the Parameter Name Retention notes in the Wiki for details.
If that solves the issue for you, it would be nice if you posted a comment here to confirm that.
Cheers,
Sam
Thank you for your reply @sbrannen . I tried adding the following configuration during compilation, but for some reason it didn’t have any effect. However, it worked fine when I reverted to version 2.7. I will continue to investigate. If there are any updates, I will provide them in this issue. Regardless of the outcome, thank you both for your help.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<parameters>true</parameters>
</configuration>
</plugin>
Comment From: funky-eyes
Hi @sbrannen
I tried many times, and I ensured that I added