-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
No qualifying bean of type 'java.lang.String' in case of accidental @Autowired
@Bean
method with @Value
parameter
#33030
Comments
What does the |
On review, that exception stacktrace is a bit confusing. It actually seems to be an |
All we know is that we changed nothing except the one version, and this broke. What went into 6.1.9 that could have caused this regression? |
@jimshowalter can you reproduce on several machines? This looks really low-level and nothing that rings a bell. Perhaps a JAR is corrupted? |
A jar is not corrupted. We trivially upgraded Spring as part of our normal housekeeping, and it blew up our service, which has worked without any Spring-related issues for literally years. |
Tried another of our services, exact same failure. |
How do you know that? Can you reproduce on several machines is my question. We're both trying to help you and your replies are not helpful. Please take the time to process the feedback as it's unclear what your setup is. If this is so easy to reproduce, you should be able to provide us a sample. Also, the above is using Spring Boot so it's unclear why you didn't upgrade that rather than framework explicitly. |
This is on several machines. It fails locally on a Mac M1, and in our Jenkins pipeline on RHEL8. |
It's definitively straightforward to reproduce in our services, but asking us to cut it down to a small reproducible test case is not so straightforward. We're assuming this will prove to be a systemic problem with the latest 6.1.9, and that others will start reporting the same error. |
The entire Spring Boot test suite has upgraded to Spring Framework 6.1.9 and ran successfully, exercising quite a lot of integration tests in the process. We're not asking for a test case, but rather a simple application created on https://start.spring.io that fails. Given your feedback, this should be pretty straigthforward to replicate the bean/injection arrangement and demonstrate the failure. |
There's always a chance for regressions but I'm afraid this is not a very obvious one. We will need your help to reproduce this in some way. Oh, and thanks for trying 6.1.9 early. Anything to fix here, we can still do so for the corresponding Spring Boot releases next Thursday. |
This comment was marked as duplicate.
This comment was marked as duplicate.
The problem with trying to create a test case is, you already had a bunch of test cases that didn't catch this, and in the past whenever we've tried to reduce a large git repo to a small test case, the problem went away. You're asking us to basically spend a couple of days trying to boil this down to something small, when the problem could be due to interactions among many components, none of which are under our control. ./gradlew dependencyUpdates (the ben-manes dependencies plugin) shows that all of our dependencies are on the latest versions, if that helps at all. |
If you see the same failure in several services, do you mean the very same Since I imagine this has been masked with the foo/bar naming there, it would be good to identify what kind of method it is that actually fails there. Otherwise, we have no chance to get closer to the problem. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This isn't going anywhere. If you don't want to take the time to provide the info, we unfortunately won't be able to help until someone else does (assuming they're affected by the same issue). I am not sure the exception you've shared is the root cause but rather a cascading effect of something else. You could share the full starting log of your application (by email if you don't want to provide them here) as well as the code that contributed |
For a bit of context from our side: The key problem in our recent AspectJ support revision is Spring AOP with AspectJ aspect classes versus compile-time and load-time weaving. We have to accept ajc-compiled aspects for use with Spring AOP now, according to recent AspectJ recommendations for reusable aspect classes, whereas traditionally such ajc-compiled aspects were exclusively encountered with bytecode weaving. Looking at your provided log, I see no "Ignoring incompatible aspect/advice" entries, so it does not seem to be those two new defensive catch blocks for AspectJ processing that we added in 6.1.9. The only other change in 6.1.9 is that we avoid potential duplicate execution of aspects through not applying ajc-compiled aspect classes to ajc-compiled bean classes in the application, assuming that those have been compile-time or load-time weaved. In any case, we intend to keep existing setups running as far as possible. If some variation of the above turns out to be the root of the problem here, we're keen to fix it in time for the Spring Boot releases next Thursday. |
Managed to boil it down into a simple test case. It's having trouble taking config values from yaml and passing them into a configuration object. See README.md. |
This comment was marked as resolved.
This comment was marked as resolved.
Thanks @jimshowalter, we'll sort it out ASAP. Getting late here in European time, might take until Monday to get fully into it. From a quick glance: That Such a plain |
Interesting--that indeed fixed it! We'll make a pass through our services looking for more examples of unnecessary annotations. |
Glad to hear! We'll try to find out why we tolerated that before then. Even with the extra annotation, it should still start up properly (even when calling that method twice for separate purposes), so we'll try to restore the previous behavior there in any case... maybe with a warn log entry though, otherwise such an accidental overuse of |
@Autowired
@Bean
method with @Value
parameter
This turns out to be a side effect caused by #32888 where bridge method resolution is more capable now. Previously, we did not detect So we accidentally ignored such an arrangement before, now - for a different accident - we process it and expose a side effect of the mismatch. The correct solution is to never declare |
Or release a breaking change? It's not difficult to fix the breakages. |
We might actually do a breaking change in a future release, forcing such accidental declarations to be cleaned up. It's just the potential mid-line breakage in 6.1.x - possibly on code that the people affected cannot easily change since it is not in their hands - that we need to find a remedy for. That is totally doable, just a matter of where specifically ( |
A few minutes ago ./gradlew dependencyUpdates showed that 6.1.9 is available.
Upgraded to that from 6.1.8, and startup failed like this:
Should be a really easy regression to track down, between those two minor versions.
The text was updated successfully, but these errors were encountered: