Jodd Components Explained: Core, Lagarto, Petite, and More

Jodd Components Explained: Core, Lagarto, Petite, and More

Overview

Jodd is a modular Java toolkit offering lightweight libraries for common development needs. It emphasizes small, focused components that can be used independently.

Core

  • Purpose: Utility classes and foundational APIs used across other Jodd modules.
  • Key features: string helpers, collections utilities, reflection helpers, configuration loaders, I/O utilities.
  • Use case: Drop-in utilities to simplify routine tasks without pulling heavy dependencies.

Lagarto

  • Purpose: HTML/XML parser and template engine foundation.
  • Key features: tolerant parsing of malformed HTML, fast DOM-like API, token-based parsing suitable for high-performance scenarios.
  • Use case: Parsing or manipulating HTML/XML, building fast templating or scraping tools.

Petite

  • Purpose: Lightweight dependency injection (DI) container.
  • Key features: constructor/setter injection, annotations support, lifecycle callbacks, simple configuration.
  • Use case: Small applications or libraries that need DI without full-featured frameworks like Spring.

Other Notable Modules

  • Madvoc: MVC web framework built on top of Jodd components; minimal and fast.
  • Proxetta: Runtime proxy generation for method interception (AOP-style).
  • Vibe: Asynchronous utilities and concurrency helpers.
  • Lagarto-SL (or templating addons): Template engines and extensions leveraging Lagarto parsing.
  • Petite-Props / Jodd-Config: Configuration integration for Petite-managed components.

When to Choose Jodd

  • Preference for minimal, modular libraries over large frameworks.
  • Need for fast parsing or lightweight DI in microservices, CLI tools, or small web apps.
  • Projects where keeping dependencies and startup time low is important.

Quick example (Petite DI)

java

// Define a component public class HelloService { public String sayHello() { return “Hello Jodd”; } } // Register and use PetiteContainer pc = new PetiteContainer(); pc.registerBean(HelloService.class); HelloService svc = pc.getBean(HelloService.class); System.out.println(svc.sayHello());

Resources

  • Official Jodd site and GitHub repo for module docs and examples.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *