Java / Micronaut Interview questions
What is ahead-of-time (AOT) compilation in Micronaut?
In Micronaut, AOT compilation refers to the work its annotation processors do during the build, before the JVM ever starts the application, to precompute everything that other frameworks typically figure out at runtime.
During compilation, Micronaut analyzes annotated classes and generates plain Java bytecode: BeanDefinition classes describing constructors and injections, AOP proxy classes for advised methods, and metadata for configuration property binding and validation. None of this requires scanning the classpath or reflecting over classes when the app boots.
Beyond dependency injection, Micronaut also has a separate "Micronaut AOT" optimization pass, used heavily for GraalVM native image builds, that precomputes things like environment deduction and YAML-to-property caching, further trimming startup work.
More Related questions...