Repository navigation
Recreate the scoped proxy of a changed @Configuration bean - #698
Open
kamilkrzywanski wants to merge 1 commit into
Open
kamilkrzywanski wants to merge 1 commit into
kamilkrzywanski wants to merge 1 commit into
Conversation
A scoped proxy @bean (e.g. @SessionScope) is registered as "scopedTarget.name" with the factory method and as "name" for the proxy. After a change of the @configuration class the plugin removed only "scopedTarget.name". When the @configuration class was processed again, Spring saw the existing proxy definition and skipped the @bean method, so every call through the proxy failed with "No bean named 'scopedTarget.name' available". Remove the proxy definition together with its target. Refs HotswapProjects#393
This was referenced Nov 5, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #393
A scoped proxy
@Bean(e.g.@SessionScope, or@Scope(proxyMode = TARGET_CLASS)) is registered asscopedTarget.namewith the factory method and asnamefor the proxy (ScopedProxyFactoryBean). After a change of the@Configurationclass,SpringBeanReload.resetConfigurationBeanDefinitionremoved onlyscopedTarget.name. When the configuration class was processed again, Spring saw the existing proxy definition and skipped the@Beanmethod, so every call through the proxy failed withNo bean named 'scopedTarget.name' available.Changes:
scopedTarget.nameis removed, also remove the proxy definitionnameif itstargetBeanNameis that target. Both are registered again from the configuration class. Beans that depend on the proxy are recreated, as for other@Beanmethods of a changed configuration. A proxy instance kept elsewhere still works, it looks up the target by name.@Beanmethod, and a plain@Beanof the same configuration is reloaded as before.Tested with a Spring 6.2 application (
@SessionScope-like scope with@Qualifier): before, every call failed after changing the configuration, now it works. Full build with tests passes on DCEVM 11.This does not fix the startup error from #393 on Spring 5.3. That one comes from
setCacheBeanMetadata(false), see #603.