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

CGLIB error since upgrading to Spring Boot 3.4.3 #44492

Closed
radarsh opened this issue Feb 28, 2025 · 0 comments
Closed

CGLIB error since upgrading to Spring Boot 3.4.3 #44492

radarsh opened this issue Feb 28, 2025 · 0 comments
Labels
for: external-project For an external project and not something we can fix status: duplicate A duplicate of another issue

Comments

@radarsh
Copy link

radarsh commented Feb 28, 2025

We upgraded our application from Spring Boot 3.4.2 to 3.4.3 and ever since doing that, tests that use ApplicationContextRunner have become very flaky and produce this error:

Caused by: java.lang.NullPointerException: Cannot read field "generatedClass" because "data" is null
	at org.springframework.cglib.proxy.Enhancer.nextInstance(Enhancer.java:783)
	at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:321)
	at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:562)
	at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:407)
	at org.springframework.context.annotation.ConfigurationClassEnhancer.createClass(ConfigurationClassEnhancer.java:169)
	at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:121)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:539)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:311)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:363)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:153)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:791)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:609)

The test itself is rather simple and is using ApplicationContextRunner something like this:

	var applicationContextRunner = new ApplicationContextRunner()
		.withUserConfiguration(MyConfiguration.class)
		.withBean(SimpleMeterRegistry);

MyConfiguration is as follows:

@Configuration(proxyBeanMethods = false)
@ComponentScan(excludeFilters = @Filter(type = REGEX, pattern = ".*example\\.core\\.autoconfigure.*"))
@ConfigurationPropertiesScan
public class MyConfiguration {
}

It's to be noted that if the test is run on its own it never fails.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 28, 2025
@wilkinsona wilkinsona added status: duplicate A duplicate of another issue for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants