Skip to content
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

the issue of doCreateBean #34442

Open
799332391 opened this issue Feb 18, 2025 · 5 comments
Open

the issue of doCreateBean #34442

799332391 opened this issue Feb 18, 2025 · 5 comments
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: waiting-for-triage An issue we've not yet triaged or decided on

Comments

@799332391
Copy link

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#doCreateBean

if (earlySingletonExposure) {
			Object earlySingletonReference = getSingleton(beanName, false);
			if (earlySingletonReference != null) {
				if (exposedObject == bean) {
					exposedObject = earlySingletonReference;
				}

exposedObject = earlySingletonReference;
If this assignment is indeed not redundant, it suggests that the custom getEarlyBeanReference method results in the reference no longer pointing to the final, fully initialized bean. Consequently, would the subsequent execution of registered bean destruction callbacks become unnecessary in this scenario?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 18, 2025
@bclozel
Copy link
Member

bclozel commented Feb 18, 2025

This report is quite similar to #29756

Rather than reading the code and thinking about potential issues, we would rather look at a concrete example where you can demonstrate a problem.

@bclozel bclozel closed this as completed Feb 18, 2025
@bclozel bclozel added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Feb 18, 2025
@799332391
Copy link
Author

I didn't say that this line of code has execution problems. It's just that after considering the context, I felt a bit confused about this line. I have read #29756, and my reply and question are also based on #29756. The replies in #29756 at least explained some of the reasons, but your reply doesn't provide any substantial explanation.

@bclozel
Copy link
Member

bclozel commented Feb 18, 2025

Thanks but we'd rather spend time on actual issues and enhancements reported by the community. Explaining the codebase line by line is not our top priority. If you think there is a behavior problem with this code, you can probably illustrate it with a simple application and share it with us.

@799332391
Copy link
Author

demo2.zip

@799332391
Copy link
Author

Please set a breakpoint at this line of code in AbstractAutowireCapableBeanFactory.java: exposedObject = earlySingletonReference;. Add a breakpoint condition: beanName.contains("serviceA"). Then, compare the execution results with the MyProcessor class commented out and not commented out.

@bclozel bclozel reopened this Feb 22, 2025
@bclozel bclozel added status: waiting-for-triage An issue we've not yet triaged or decided on in: core Issues in core modules (aop, beans, core, context, expression) and removed status: duplicate A duplicate of another issue labels Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: waiting-for-triage An issue we've not yet triaged or decided on
Projects
None yet
Development

No branches or pull requests

3 participants