Skip to content

CGLIB proxies are not used at runtime on @Configuration classes in AOT mode #29107

@sdeleuze

Description

@sdeleuze

Consider the following configuration class:

@Configuration
public class MyConfiguration {
	@Bean
	A a() { return new A(); }

	@Bean
	B b() { return new B(this.a()); }
	
	static class A {
		public A() { System.out.println("A constructor"); }
	}

	static class B {
		public B(A a) { System.out.println("B constructor"); }
	}
}

On JVM in regular mode, it prints:

A constructor
B constructor

On JVM in AOT mode or native, while it seems CGLIB proxies are generated correctly at build time, but they seems not used since it prints:

A constructor
A constructor
B constructor

The code generated AOT maybe needs to be updated to leverage those CGLIB proxies.

Metadata

Metadata

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)theme: aotAn issue related to Ahead-of-time processingtype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions