Skip to content

CGLIB error since upgrading to Spring Boot 3.4.3 #44492

Closed as duplicate
Closed as duplicate

Description

@radarsh

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.

Activity

  1. added
    status: waiting-for-triage
    on Feb 28, 2025
  2. added
    status: duplicate
    for: external-project
    and removed
    status: waiting-for-triage
    on Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: external-projectstatus: duplicate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions