finds.dev← search

// the find

j-easy/easy-rules

★ 5,263 · Java · MIT · updated May 2024

The simple, stupid rules engine for Java

Easy Rules is a small Java rules engine: define conditions and actions as POJOs (via annotations, a fluent builder, or MVEL/SpEL/JEXL expressions), register them, and fire them against a Facts object. It's for teams who want the Fowler 'bunch of objects with conditions and actions' pattern without pulling in Drools.

The core API is genuinely small — Rule, Rules, Facts, RulesEngine — and you can read the whole thing in an afternoon. Modules are split by Maven artifact (core vs mvel/spel/jexl), so you're not forced to drag in an expression language you don't use. Composite rule support (UnitRuleGroup, ConditionalRuleGroup, ActivationRuleGroup) covers the common 'AND these conditions' and 'first-match' patterns without you hand-rolling them. Rule definitions can also come from YAML/JSON files via RuleDefinitionReader, which is a reasonable way to let non-Java rule content live outside the jar.

It's been in maintenance mode since December 2020 — only bug fixes, no new features — and the last push was May 2024, so don't expect the API to grow or performance work to happen. There's no built-in tracing or explainability beyond RuleListener callbacks, so debugging why a rule did or didn't fire in production means writing your own logging around every condition. Rules expressed as MVEL/SpEL/JEXL strings (the YAML/JSON path) lose compile-time checking and IDE refactoring support — a typo in a condition string fails at runtime, not build time. The inference engine (InferenceRulesEngine) re-evaluates all rules on every pass until none apply, which is fine for a handful of rules but will surprise you on latency if you feed it hundreds.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →