A deep dive into using Java's ResourceBundleProvider API (introduced in Java 9) to enable cross-module resource bundle look-ups in a modular Java application. The post walks through a multi-module 'modular monolith' example where individual modules contribute locale-specific error message bundles, while a central error handler retrieves them without knowing about the specific modules. Key challenges covered include avoiding split packages, passing contextual information via Locale variants, supporting both module path and classpath execution, and handling Java 8 compatibility using multi-release JARs and ResourceBundleControlProvider.

11m read timeFrom morling.dev
Post cover image

Sort: