chore(spring): set proxyBeanMethods=false on Vaadin Spring config classes#24291
Open
torsten-liermann wants to merge 1 commit intovaadin:24.9from
Open
chore(spring): set proxyBeanMethods=false on Vaadin Spring config classes#24291torsten-liermann wants to merge 1 commit intovaadin:24.9from
torsten-liermann wants to merge 1 commit intovaadin:24.9from
Conversation
…sses VaadinApplicationConfiguration and SpringBootAutoConfiguration both declare @configuration without an explicit proxyBeanMethods setting, which defaults to true. The CGLIB-enhanced subclass proxy is only needed when @bean methods cross-reference other @bean methods of the same class — in either class no such self-cross-reference exists, and neither class uses @transactional, @async or other AOP that relies on the configuration self-proxy. Setting proxyBeanMethods=false drops the CGLIB enhancement step for these classes during ApplicationContext initialization. This avoids a known class-loader contention path observed when several Vaadin WARs are deployed in parallel inside a Jakarta EE EAR. VaadinServletConfiguration is intentionally not changed: its vaadinRootMapping bean directly invokes vaadinForwardingController() on the configuration class and therefore requires the @bean self proxy.
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.
Summary
VaadinApplicationConfigurationandSpringBootAutoConfigurationdeclare
@Configurationwithout an explicitproxyBeanMethodssetting, which defaults to
true. Neither class self-cross-referencesits own
@Beanmethods, and neither uses@Transactional,@Asyncor other AOP that requires the configuration self-proxy —so the CGLIB-enhancement step that the default brings is dead weight.
Setting
proxyBeanMethods = falseon both classes drops thatenhancement step. Per Spring's own
@ConfigurationJavadoc,this is the recommended setting whenever
@Beancross-referencesare not in use.
Diff
Why this matters in practice
In a Jakarta EE FAT-EAR with multiple Vaadin-bearing WARs deployed
in parallel on WildFly / JBoss EAP, each WAR drives its own Spring
ApplicationContextthrough these two classes concurrently. TheirCGLIB-enhancement stage races on the JBoss-Modules class-loader
lock and produces a deployment hang. Removing the proxy (which is
unused) removes the contention.
Intentionally not changed
VaadinServletConfiguration(imported via@ImportfromSpringBootAutoConfiguration) really does have a selfcross-reference:
vaadinRootMappingdirectly invokesvaadinForwardingController(). That class needs the@Beanself proxy and is left untouched.
Risk
Minimal. The change is local to two configuration classes that
do not exercise the proxy semantics. Subclasses with custom
@Beanself-cross-references would need their ownproxyBeanMethods = true— none such exist upstream.