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

Failure to process a bean definition ahead-of-time with an instance supplier should provide more contextual information #32775

Closed
snicoll opened this issue May 7, 2024 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Milestone

Comments

@snicoll
Copy link
Member

snicoll commented May 7, 2024

If AOT fails to generate the code, it doesn't provide enough context to track down the problem.

Here's an example:

Exception in thread "main" java.lang.IllegalStateException: Default code generation is not supported for bean definitions declaring an instance supplier callback: Root bean: class [null]; scope=singleton; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodNames=null; destroyMethodNames=null	
	at org.springframework.beans.factory.aot.DefaultBeanRegistrationCodeFragments.getTarget(DefaultBeanRegistrationCodeFragments.java:83)	
	at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.generateBeanDefinitionMethod(BeanDefinitionMethodGenerator.java:85)	
	at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.lambda$generateRegisterBeanDefinitionsMethod$2(BeanRegistrationsAotContribution.java:90)	
	at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)	
	at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.generateRegisterBeanDefinitionsMethod(BeanRegistrationsAotContribution.java:88)	
	at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.lambda$applyTo$1(BeanRegistrationsAotContribution.java:73)	
	at org.springframework.aot.generate.GeneratedMethod.<init>(GeneratedMethod.java:54)	
	at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:112)	
	at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:89)	
	at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.applyTo(BeanRegistrationsAotContribution.java:72)	
	at org.springframework.context.aot.BeanFactoryInitializationAotContributions.applyTo(BeanFactoryInitializationAotContributions.java:78)	
	at org.springframework.context.aot.ApplicationContextAotGenerator.lambda$processAheadOfTime$0(ApplicationContextAotGenerator.java:58)	
	at org.springframework.context.aot.ApplicationContextAotGenerator.withCglibClassHandler(ApplicationContextAotGenerator.java:67)	
	at org.springframework.context.aot.ApplicationContextAotGenerator.processAheadOfTime(ApplicationContextAotGenerator.java:53)	
	at org.springframework.context.aot.ContextAotProcessor.performAotProcessing(ContextAotProcessor.java:106)	
	at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:84)	
	at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:49)	
	at org.springframework.context.aot.AbstractAotProcessor.process(AbstractAotProcessor.java:82)	
	at org.springframework.boot.SpringApplicationAotProcessor.main(SpringApplicationAotProcessor.java:80)
@snicoll snicoll added type: enhancement A general enhancement theme: aot An issue related to Ahead-of-time processing labels May 7, 2024
@snicoll snicoll added this to the 6.1.x milestone May 7, 2024
@snicoll snicoll self-assigned this May 7, 2024
@jhoeller jhoeller added the in: core Issues in core modules (aop, beans, core, context, expression) label May 7, 2024
@snicoll snicoll changed the title AOT generation failure should provide more contextual information Failure to process a bean definition ahead-of-time with an instance supplier should provide more contextual information May 8, 2024
@snicoll snicoll modified the milestones: 6.1.x, 6.1.7 May 8, 2024
@snicoll snicoll closed this as completed in 5b1278d May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants