Skip to content

Fail to generate AOT code, RegisteredBean.getBeanFactory() #2675

@mhalbritter

Description

@mhalbritter

Hey,

all of the spring-data AOT smoke tests are broken (e.g. data-jdbc) because of this exception while generating AOT code:

2022-08-10T13:51:50.508Z  INFO 553 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 37 ms. Found 1 JDBC repository interfaces.

Exception in thread "main" java.lang.NoSuchMethodError: 'org.springframework.beans.factory.config.ConfigurableBeanFactory org.springframework.beans.factory.support.RegisteredBean.getBeanFactory()'
	at org.springframework.data.aot.ManagedTypesBeanRegistrationAotProcessor.processAheadOfTime(ManagedTypesBeanRegistrationAotProcessor.java:58)
	at org.springframework.beans.factory.aot.BeanDefinitionMethodGeneratorFactory.getAotContributions(BeanDefinitionMethodGeneratorFactory.java:141)
	at org.springframework.beans.factory.aot.BeanDefinitionMethodGeneratorFactory.getBeanDefinitionMethodGenerator(BeanDefinitionMethodGeneratorFactory.java:99)
	at org.springframework.beans.factory.aot.BeanRegistrationsAotProcessor.processAheadOfTime(BeanRegistrationsAotProcessor.java:44)
	at org.springframework.beans.factory.aot.BeanRegistrationsAotProcessor.processAheadOfTime(BeanRegistrationsAotProcessor.java:32)
	at org.springframework.context.aot.BeanFactoryInitializationAotContributions.getContributions(BeanFactoryInitializationAotContributions.java:67)
	at org.springframework.context.aot.BeanFactoryInitializationAotContributions.<init>(BeanFactoryInitializationAotContributions.java:49)
	at org.springframework.context.aot.BeanFactoryInitializationAotContributions.<init>(BeanFactoryInitializationAotContributions.java:44)
	at org.springframework.context.aot.ApplicationContextAotGenerator.processAheadOfTime(ApplicationContextAotGenerator.java:54)
	at org.springframework.boot.AotProcessor.performAotProcessing(AotProcessor.java:150)
	at org.springframework.boot.AotProcessor.process(AotProcessor.java:111)
	at org.springframework.boot.AotProcessor.main(AotProcessor.java:219)

This method has been changed in Spring Framework Snapshots.

The smoke tests still use org.springframework.data:spring-data-commons:3.0.0-M5, but even forcing the version to 3.0.0-SNAPSHOT with this:

constraints {
  implementation("org.springframework.data:spring-data-commons:3.0.0-SNAPSHOT")
}

doesn't resolve the issue.

When running a mvn dependency:tree in this codebase it looks like it builds against Spring Framework 6.0.0-M5: [INFO] +- org.springframework:spring-beans:jar:6.0.0-M5:compile

If this is intended, feel free to close the issue :)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions