Skip to content

chore(spring): set proxyBeanMethods=false on Vaadin Spring config classes#24291

Open
torsten-liermann wants to merge 1 commit intovaadin:24.9from
torsten-liermann:feature/proxybeanmethods-24.9
Open

chore(spring): set proxyBeanMethods=false on Vaadin Spring config classes#24291
torsten-liermann wants to merge 1 commit intovaadin:24.9from
torsten-liermann:feature/proxybeanmethods-24.9

Conversation

@torsten-liermann
Copy link
Copy Markdown

Summary

VaadinApplicationConfiguration and SpringBootAutoConfiguration
declare @Configuration without an explicit proxyBeanMethods
setting, which defaults to true. Neither class self-cross-references
its own @Bean methods, and neither uses @Transactional,
@Async or other AOP that requires the configuration self-proxy —
so the CGLIB-enhancement step that the default brings is dead weight.

Setting proxyBeanMethods = false on both classes drops that
enhancement step. Per Spring's own
@Configuration Javadoc,
this is the recommended setting whenever @Bean cross-references
are not in use.

Diff

-@Configuration
+@Configuration(proxyBeanMethods = false)
 public class VaadinApplicationConfiguration {

-@Configuration
+@Configuration(proxyBeanMethods = false)
 public class SpringBootAutoConfiguration {

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
ApplicationContext through these two classes concurrently. Their
CGLIB-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 @Import from
SpringBootAutoConfiguration) really does have a self
cross-reference: vaadinRootMapping directly invokes
vaadinForwardingController(). That class needs the @Bean
self 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
@Bean self-cross-references would need their own
proxyBeanMethods = true — none such exist upstream.

…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.
@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented May 7, 2026

CLA assistant check
All committers have signed the CLA.

@mcollovati mcollovati added the Contribution PRs coming from the community or external to the team label May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Contribution PRs coming from the community or external to the team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants