Java / Micronaut Interview questions
How does Micronaut Data work?
Micronaut Data is a database access toolkit that generates repository implementations at compile time, the same way Micronaut generates DI metadata: there's no runtime proxy, no reflection-based query building, and no Hibernate-style session/proxy machinery involved by default.
You define a repository interface extending a marker like CrudRepository or PageableRepository, and annotate it with the data-source flavor you want, such as @JdbcRepository or @Repository for JPA.
@JdbcRepository(dialect = Dialect.POSTGRES) public interface OrderRepository extends CrudRepository<Order, Long> { List<Order> findByStatus(String status); }
At compile time, Micronaut's annotation processor parses method names like findByStatus and generates the actual SQL and the Java implementation class that executes it. The query is validated against your entity at build time, so a typo in a method name fails the build instead of failing at runtime.
More Related questions...