-
Notifications
You must be signed in to change notification settings - Fork 41.1k
Circular dependency in @SpringBootTest
for an app that starts normally
#12280
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
Comments
@SpringBootTest
for an app that@SpringBootTest
for an app that starts normally
When the Creation of
The creation of the |
It works in the main application case as the application context is an |
As expected based on the description above, the tests pass if they're configured with a non-mock web environment:
|
Thanks for the detailed analysis @wilkinsona! |
It's post-processed for a second time because I'm pretty sure that this is a Framework bug as a factory bean the produces in singleton is being asked for its bean twice. My understanding of the factory bean contract is that that should not happen. There's also a comment in the code that suggests that this sort of circular lookup should be handled:
That handling doesn't seem to work in the case. I suspect it's because the cycle is occurring during the post-processing. |
I've opened SPR-16783. I managed to produce a similar, although not identical, failure without Boot's involvement. I'm going to close this one as I'm hopeful that a fix will be made in Framework. If that turns out not to be the case, we can re-open this issue. |
@vpavic there is a fix in the upcoming |
Thanks - I've confirmed that the sample app provided in spring-projects/spring-session#995 works with Boot |
Can someone please suggest to me how and where I can open a ticket that seems the exact same issue, but this issue is with:
I have tested this and it does not happen with HSQL nor Derby. |
@mickknutson Thanks for asking. Let's start with a Boot issue. We can move to another project if that turns out to be necessary, but it sounds like some initial diagnosis at the Boot level will be needed at least. If/when you open an issue, please provide a minimal sample that reproduces the behaviour you've described. |
This was originally reported as spring-projects/spring-session#995.
An application that starts up normally (either using
java -jar
, GradlebootRun
task or IDE) fails in@SpringBootTest
with reported circular dependency:The original report contains sample project that can be used to reproduce the issue. Sample uses Boot
1.5.10.RELEASE
but the same behavior is observed with2.0.0.RC2
, by using Gradle 4.x and applying this diff:The text was updated successfully, but these errors were encountered: