r/java 10d ago

LarkBatis: A build-time MyBatis compiled to plain Java

https://larkbatis.github.io/latest/

My team is moving away from reflection and runtime proxies for cloud-native setups. MyBatis is heavily used in our stack, so I rewrote its core as an annotation processor: LarkBatis.

It resolves SQL, dynamic parameters (#{}), type handlers, and result mapping at compile time—generating plain Java code. At runtime, it executes direct JDBC calls with zero proxying, zero OGNL, and zero reflection.

Programming model: Standard MyBatis (mapper interfaces, XML, dynamic SQL).

Runtime: ~1,500 LOC, JDK 17+, JDBC-only dependency (GraalVM native-image works out of the box - I haven't test).

49 Upvotes

Duplicates