I have a Spring Boot project with roughly 10k beans. When I use the spring-boot process-aot plugin, the generated code is rejected by javac with the error message Code too large /home/dreamlike/javaCode/leydenPlayground/leyden-spring/target/spring-aot/main/sources/io/github/dreamlike/LeydenSpringMain__BeanFactoryRegistrations.java 10049:15 (this file has about 20k lines).

I’m wondering if this plugin allows for the creation of multiple BeanFactoryRegistration files to avoid this issue? The specific reproduction code can be found in this repository https://github.com/dreamlike-ocean/leydenPlayground

Comment From: snicoll

Thanks for the report. This was bound to happen since we're generating one line per bean definitions in that file. Fortunately, thanks to the help of @philwebb, this problem is largely reduced due to us using isolated generated classes for the bean definitions themselves. We may be pragmatic about this particular file, as I am not sure we can fix this in a generic fashion.

Comment From: snicoll

For the record the size of the file isn't the problem, a size limit on methods is. To fix this, we now slice bean registrations per 1000 bean definitions in isolated methods. The number is a bit arbitrary so perhaps we'll have to adapt somehow but that looks good enough for a start. And your sample now works with 6.2.0-SNAPSHOT.