<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:fh="http://purl.org/syndication/history/1.0"><channel><title>rulii | rulii blog</title><description>rulii is an open-source Java business rule engine: rules, rule sets, rule flows, validation, scripting and tracing, with Spring Boot and Jakarta Bean Validation integrations.</description><link>https://rulii.org/</link><language>en</language><fh:complete/><atom:link rel="self" href="https://rulii.org/blog/rss.xml"/><item><title>Optimizing rulii</title><link>https://rulii.org/blog/optimizing-rulii/</link><guid isPermaLink="true">https://rulii.org/blog/optimizing-rulii/</guid><description>rulii 2.2.0 ran 1.4 million rules a second on one thread. 2.3.0 runs 8.1 million, and the rules do exactly what they did. Where the time was going, what changed, and what we measured and threw away.</description><pubDate>Tue, 01 Dec 2026 13:00:00 GMT</pubDate><content:encoded>&lt;p&gt;rulii 2.2.0 ran about 1.4 million rules a second on one thread. This is the rule:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;Rule&lt;/span&gt;&lt;span&gt; rule &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; Rule&lt;/span&gt;&lt;span&gt;.builder()&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;.name(&lt;/span&gt;&lt;span&gt;&quot;freeShippingRule&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;.given(condition((&lt;/span&gt;&lt;span&gt;Integer&lt;/span&gt;&lt;span&gt; age, &lt;/span&gt;&lt;span&gt;String&lt;/span&gt;&lt;span&gt; country) &lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt; age &lt;/span&gt;&lt;span&gt;&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;18&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;#x26;&amp;#x26;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&quot;CA&quot;&lt;/span&gt;&lt;span&gt;.equals(country)))&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;.then(action((&lt;/span&gt;&lt;span&gt;Long&lt;/span&gt;&lt;span&gt; total) &lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt; sink &lt;/span&gt;&lt;span&gt;+=&lt;/span&gt;&lt;span&gt; total))&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;.build()&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Two comparisons and an addition. An &lt;code dir=&quot;auto&quot;&gt;if&lt;/code&gt; statement does that hundreds of millions of times a second, so nearly everything in that figure was rulii looking after itself: finding &lt;code dir=&quot;auto&quot;&gt;age&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;country&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;total&lt;/code&gt; among the bindings, handing them over, calling the two lambdas and recording what happened.&lt;/p&gt;
&lt;p&gt;rulii 2.3.0 runs the same rule 8.1 million times a second. Nothing changes in your rules, and they accept, reject and report exactly what they did. This post is about where the time was going, what changed, and what we measured and threw away.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-numbers&quot;&gt;The numbers&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Runs per second on one thread, each release as it is on Maven Central:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What runs&lt;/th&gt;
&lt;th&gt;2.2.0&lt;/th&gt;
&lt;th&gt;2.3.0&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A rule: a condition and an action&lt;/td&gt;
&lt;td&gt;1.4 million&lt;/td&gt;
&lt;td&gt;8.1 million&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A condition with three parameters matched by name&lt;/td&gt;
&lt;td&gt;1.9 million&lt;/td&gt;
&lt;td&gt;9.1 million&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A rule set of twenty rules&lt;/td&gt;
&lt;td&gt;57,000&lt;/td&gt;
&lt;td&gt;329,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A rule set of ten built-in validators&lt;/td&gt;
&lt;td&gt;38,000&lt;/td&gt;
&lt;td&gt;215,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A rule flow of five steps&lt;/td&gt;
&lt;td&gt;272,000&lt;/td&gt;
&lt;td&gt;1.5 million&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A new &lt;code dir=&quot;auto&quot;&gt;RuleContext&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;766,000&lt;/td&gt;
&lt;td&gt;2.6 million&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A condition written as a Java script (Janino)&lt;/td&gt;
&lt;td&gt;1.5 million&lt;/td&gt;
&lt;td&gt;4.2 million&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A condition written in JavaScript (GraalJS)&lt;/td&gt;
&lt;td&gt;7,700&lt;/td&gt;
&lt;td&gt;7,900, or 160,000 with context reuse&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;A rule set of twenty at 329,000 runs a second is 6.6 million rules a second. The ten validators at 215,000 are 2.1 million checks a second.&lt;/p&gt;
&lt;p&gt;Memory went the same way. A rule run allocated 3.5 KB and now allocates 0.5 KB; the rule set of twenty went from 71 KB to 11 KB a run. That’s the part your garbage collector notices.&lt;/p&gt;
&lt;p&gt;How to read them. They were measured with &lt;a href=&quot;https://github.com/openjdk/jmh&quot;&gt;JMH&lt;/a&gt; on one machine, on JDK 17, on one thread. Except in the &lt;code dir=&quot;auto&quot;&gt;RuleContext&lt;/code&gt; row the context is built once and kept: twelve bindings in two scopes, the way an application has one for a request. And they measure the engine, not your rules. The rules here do next to nothing, on purpose. If your rule calls a database it will run as fast as your database, in either version.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;behaviour-first&quot;&gt;Behaviour first&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;A rule engine has one job, which is to do what the rules say. Doing it quickly comes second, so every change had to show that it changed nothing before anybody looked at its numbers.&lt;/p&gt;
&lt;p&gt;For the changes at the core that meant three things. The old code and the new code were run side by side over generated cases, and what they produced was compared line by line: results, exception types, messages. Then the whole test suite. Then the test suites of rulii-spring and rulii-bean-validation, run against the changed engine.&lt;/p&gt;
&lt;p&gt;For parameter matching, which sits under everything, the comparison ran to 28 million lines, all identical. We also fed it five deliberately broken versions of the change, to find out whether the comparison would notice. It noticed all five.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;where-the-time-went&quot;&gt;Where the time went&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;We started with a list of suspects, made by reading the code. It survived about as well as such lists do: the top suspect was guilty, one was innocent, and the worst offender in validation wasn’t on it.&lt;/p&gt;
&lt;p&gt;Runs per second after each step. The first and last rows are the releases; the ones in between are development builds, one run each.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;After&lt;/th&gt;
&lt;th&gt;A rule set of twenty&lt;/th&gt;
&lt;th&gt;Ten validators&lt;/th&gt;
&lt;th&gt;A five-step flow&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;2.2.0&lt;/td&gt;
&lt;td&gt;57,000&lt;/td&gt;
&lt;td&gt;38,000&lt;/td&gt;
&lt;td&gt;272,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Read-only arguments made cheap&lt;/td&gt;
&lt;td&gt;65,000&lt;/td&gt;
&lt;td&gt;44,000&lt;/td&gt;
&lt;td&gt;292,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Parameter matching without the lists and the descriptions&lt;/td&gt;
&lt;td&gt;112,000&lt;/td&gt;
&lt;td&gt;61,000&lt;/td&gt;
&lt;td&gt;495,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The method handle adapted once&lt;/td&gt;
&lt;td&gt;243,000&lt;/td&gt;
&lt;td&gt;84,000&lt;/td&gt;
&lt;td&gt;991,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The argument array handed straight to the call&lt;/td&gt;
&lt;td&gt;294,000&lt;/td&gt;
&lt;td&gt;98,000&lt;/td&gt;
&lt;td&gt;1.16 million&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2.3.0: validators, converters and binding names as well&lt;/td&gt;
&lt;td&gt;329,000&lt;/td&gt;
&lt;td&gt;215,000&lt;/td&gt;
&lt;td&gt;1.5 million&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;div&gt;&lt;h3 id=&quot;read-only-arguments&quot;&gt;Read-only arguments&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;A condition decides; it doesn’t change things. So rulii hands a condition its arguments read-only, and the documentation says so.&lt;/p&gt;
&lt;p&gt;That guard had a price, and the quick win was to make it optional. With it switched off, fifteen tests failed, all with the same complaint: a write that should’ve been refused went through. They were right, so the guard stayed on and we went looking for what it cost.&lt;/p&gt;
&lt;p&gt;Two things. The argument list was copied on every call, whether or not anything in it needed protecting, and usually nothing does. And every value read through the read-only view built a complete copy of its binding first, which a script pays for on every variable it touches. Now the list is copied only when an argument needs a read-only version, and a value is read where it is. For a rule written in Java, the guard kept on measured within noise of the guard switched off.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;sentences-nobody-read&quot;&gt;Sentences nobody read&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;For every parameter of every call, the engine wrote a sentence explaining how it had matched the parameter to a binding. It’s a good sentence, and it’s useful when a rule doesn’t get the value you expected. Nobody was reading it the other few million times a second. Around it sat a small pile of lists: one per matching strategy, one for the strategies combined, each wrapped to make it unmodifiable.&lt;/p&gt;
&lt;p&gt;Now the sentence is written when somebody asks for it, and no list is made when nothing matches. A condition with three named parameters went from about 2 million runs a second to about 5 million, and from 2.9 KB a run to 0.6 KB.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;calling-the-rule&quot;&gt;Calling the rule&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;The most expensive thing the engine did for a rule was call it.&lt;/p&gt;
&lt;p&gt;A rule’s method is called through a &lt;code dir=&quot;auto&quot;&gt;MethodHandle&lt;/code&gt;, with &lt;code dir=&quot;auto&quot;&gt;invokeWithArguments&lt;/code&gt;. That call is the convenient one: it takes any number of arguments and sorts out the types. On JDK 17 it also builds a new adapter around the handle every time it’s called. Measured on its own, the call ran about 12 million times a second.&lt;/p&gt;
&lt;p&gt;The handle is now adapted once, when the rule is built, and after that the same call runs about 300 million times a second. By then it was about half of what a rule cost, so rules got twice as fast in one change.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;the-argument-array&quot;&gt;The argument array&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;Arguments were resolved into an array, wrapped in a list, turned back into an array for the call and copied once more on the way in. The array now goes straight through. Thirteen to sixteen percent, for removing three conversions that cancelled each other out.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;validators&quot;&gt;Validators&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;In 2.2.0 a built-in validator cost three to four times what a rule did, and it wasn’t on the list of suspects. &lt;code dir=&quot;auto&quot;&gt;Validators.notNull(binding(&quot;name&quot;))&lt;/code&gt; read &lt;code dir=&quot;auto&quot;&gt;name&lt;/code&gt; through the engine’s whole function pipeline, parameter matching included, and did so twice for each validator. It now reads the binding. Ten validators went from 98,000 runs a second to more than 200,000.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;building-a-context&quot;&gt;Building a context&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;We expected the cost of a new &lt;code dir=&quot;auto&quot;&gt;RuleContext&lt;/code&gt; to be spread across all the services it sets up. It wasn’t. More than half of it was one of them: every new context created the eighteen built-in type converters, and each converter looked up its own generic types by reflection, in case they’d changed since the last context. They hadn’t. The converters are created once now and shared; they have no state.&lt;/p&gt;
&lt;p&gt;The other find was the name check. Every binding has its name checked, and the check was a regular expression: a matcher per name, to confirm that &lt;code dir=&quot;auto&quot;&gt;age&lt;/code&gt; is a valid identifier. A loop over the characters does the same, and agreed with the regular expression on 2.3 million names.&lt;/p&gt;
&lt;p&gt;Between them, 766,000 new contexts a second became 2.6 million. That matters most to code that calls &lt;code dir=&quot;auto&quot;&gt;rule.run(bindings)&lt;/code&gt; and gets a new context each time.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-we-measured-and-didnt-keep&quot;&gt;What we measured and didn’t keep&lt;/h2&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Skipping the tracer when nobody is listening.&lt;/strong&gt; No difference worth having. The JIT compiler had already worked that out.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Plain reflection instead of method handles.&lt;/strong&gt; Just as fast on JDK 17. It also changed the exception a caller sees in 469 of 1,018 test calls, mostly when an argument has the wrong type. Out.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Passing more than four arguments directly.&lt;/strong&gt; Built, measured, no better than the adapter. Four stayed four.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Switching the read-only guard off.&lt;/strong&gt; See above. Fifteen tests.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;&lt;h2 id=&quot;javascript&quot;&gt;JavaScript&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The odd row in the first table is GraalJS: about 7,900 evaluations a second, in both releases, whatever the script says.&lt;/p&gt;
&lt;p&gt;The script is &lt;code dir=&quot;auto&quot;&gt;ctx.age &gt;= 18&lt;/code&gt;, and on its own it takes about a microsecond. But every evaluation ran in a JavaScript context created for it and closed after it, and creating a context takes more than a hundred times as long as the script. That isolation is worth something, since one script can’t leave anything behind for the next. It’s also nearly all of the bill.&lt;/p&gt;
&lt;p&gt;Several ways around it didn’t survive:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Reuse a context and run the script in it as it is.&lt;/strong&gt; A script with a top-level &lt;code dir=&quot;auto&quot;&gt;let&lt;/code&gt; fails the second time: already declared.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Give each &lt;code dir=&quot;auto&quot;&gt;RuleContext&lt;/code&gt; its own JavaScript context and let the garbage collector close it.&lt;/strong&gt; Fine on one thread. On eight, with a 512 MB heap, contexts were created faster than they were collected, and three runs out of five ended in an &lt;code dir=&quot;auto&quot;&gt;OutOfMemoryError&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Check after each script whether it changed a built-in.&lt;/strong&gt; The check costs more than a new context.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Freeze the built-ins.&lt;/strong&gt; Then &lt;code dir=&quot;auto&quot;&gt;o.toString = ...&lt;/code&gt; quietly does nothing, in scripts that were minding their own business.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What 2.3.0 has is a pool of contexts, and it’s opt-in. The script runs inside a function, so what it declares ends with it, and a global it leaves behind is removed before the context is used again. The one thing not undone is a change made inside a built-in (&lt;code dir=&quot;auto&quot;&gt;String.prototype.shout = ...&lt;/code&gt;), which is why you have to ask for it. If you do, the same condition runs about 160,000 times a second. See &lt;a href=&quot;https://rulii.org/advanced/scripting/#whats-new-in-230-graaljs-context-reuse&quot;&gt;Scripting Support&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;bean-validation&quot;&gt;Bean Validation&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;rulii-bean-validation 1.0.0 turned every constraint into a rule and ran it through the engine. For &lt;code dir=&quot;auto&quot;&gt;@NotNull&lt;/code&gt; on a field that’s a lot of ceremony around one comparison.&lt;/p&gt;
&lt;p&gt;In 1.1.0 a constraint backed by one of rulii’s own validators is asked directly, and a class with nothing but such constraints is validated without bindings or a rule flow. Anything that is a rulii feature (&lt;code dir=&quot;auto&quot;&gt;@Expr&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@Validate&lt;/code&gt;, a custom &lt;code dir=&quot;auto&quot;&gt;ConstraintValidator&lt;/code&gt;) still runs in the engine. Validations per second on one thread:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What is validated&lt;/th&gt;
&lt;th&gt;1.0.0 on rulii 2.2.0&lt;/th&gt;
&lt;th&gt;1.1.0 on rulii 2.3.0&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A bean of ten satisfied constraints&lt;/td&gt;
&lt;td&gt;34,000&lt;/td&gt;
&lt;td&gt;640,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The same bean with three violations&lt;/td&gt;
&lt;td&gt;27,000&lt;/td&gt;
&lt;td&gt;160,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;An order cascading into ten lines&lt;/td&gt;
&lt;td&gt;4,400&lt;/td&gt;
&lt;td&gt;120,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;An order cascading into a hundred lines&lt;/td&gt;
&lt;td&gt;590&lt;/td&gt;
&lt;td&gt;23,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A bean with one custom &lt;code dir=&quot;auto&quot;&gt;ConstraintValidator&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;220,000&lt;/td&gt;
&lt;td&gt;800,000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Part of that is the engine getting faster underneath; the larger part is not going through the engine at all. The details are in the &lt;a href=&quot;https://rulii.org/blog/rulii-bean-validation-1-1-0/&quot;&gt;1.1.0 release notes&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;whats-left&quot;&gt;What’s left&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;A condition with no parameters runs 75 million times a second. Give it three named parameters and it runs 9 million times. So most of what a rule costs now is the engine working out which binding goes into which parameter, on every call, although the answer is nearly always the same as last time.&lt;/p&gt;
&lt;p&gt;That’s the next thing.&lt;/p&gt;
</content:encoded><category>performance</category><category>rulii</category><category>rulii-bean-validation</category></item><item><title>rulii 2.3.0 and rulii-spring 2.3.0</title><link>https://rulii.org/blog/rulii-2-3-0/</link><guid isPermaLink="true">https://rulii.org/blog/rulii-2-3-0/</guid><description>A faster engine with nothing to change in your rules, GraalJS context reuse, a flow-level exception handler that lets the flow continue, and a Spring integration where Bean Validation on rulii is opt-in and all 48 validators are XML elements.</description><pubDate>Tue, 01 Dec 2026 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;rulii 2.3.0 and rulii-spring 2.3.0 are on &lt;a href=&quot;https://central.sonatype.com/namespace/org.rulii&quot;&gt;Maven Central&lt;/a&gt;, alongside &lt;a href=&quot;https://rulii.org/blog/rulii-bean-validation-1-1-0/&quot;&gt;rulii-bean-validation 1.1.0&lt;/a&gt;, &lt;a href=&quot;https://rulii.org/blog/rulii-explorer-1-2-0/&quot;&gt;rulii-explorer 1.2.0&lt;/a&gt; and &lt;a href=&quot;https://rulii.org/blog/rulii-bom-2-3-0/&quot;&gt;rulii-bom 2.3.0&lt;/a&gt;. This post covers what changed in the core engine and the Spring integration. Several of the changes alter behaviour; they are listed together at the end. The full lists are in the &lt;a href=&quot;https://github.com/algox/rulii/blob/develop/change-log.md&quot;&gt;rulii changelog&lt;/a&gt; and the &lt;a href=&quot;https://github.com/algox/rulii-spring/blob/develop/change-log.md&quot;&gt;rulii-spring changelog&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;a-faster-engine-with-nothing-to-change&quot;&gt;A faster engine, with nothing to change&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Most of the work in 2.3.0 went into what the engine costs around your rules. On one thread it runs about 8 million rules a second where 2.2.0 ran 1.4 million, and a run allocates about a seventh of the memory. What rules accept, reject and report is the same, and there is nothing to change in your code to get it.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Runs per second, one thread&lt;/th&gt;
&lt;th&gt;2.2.0&lt;/th&gt;
&lt;th&gt;2.3.0&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A rule: a condition and an action&lt;/td&gt;
&lt;td&gt;1.4 million&lt;/td&gt;
&lt;td&gt;8.1 million&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A rule set of twenty rules&lt;/td&gt;
&lt;td&gt;57,000&lt;/td&gt;
&lt;td&gt;329,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A rule set of ten built-in validators&lt;/td&gt;
&lt;td&gt;38,000&lt;/td&gt;
&lt;td&gt;215,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A rule flow of five steps&lt;/td&gt;
&lt;td&gt;272,000&lt;/td&gt;
&lt;td&gt;1.5 million&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A new &lt;code dir=&quot;auto&quot;&gt;RuleContext&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;766,000&lt;/td&gt;
&lt;td&gt;2.6 million&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Measured with JMH on one machine, each release from Maven Central. These measure the engine’s own overhead: the rules do almost nothing, so in an application the work inside the rules (a database call, a calculation) usually dominates.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://rulii.org/blog/optimizing-rulii/&quot;&gt;Optimizing rulii&lt;/a&gt; has the full table, where the time was going and what changed.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;graaljs-context-reuse&quot;&gt;GraalJS context reuse&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Every JavaScript evaluation runs in a JavaScript context of its own, created for it and closed after it. Creating the context is nearly all of what the evaluation costs, so a simple condition runs about 7,900 times a second on one thread, whatever the script says. A &lt;code dir=&quot;auto&quot;&gt;GraalJsScriptProcessorFactory&lt;/code&gt; given &lt;code dir=&quot;auto&quot;&gt;GraalJsPoolOptions&lt;/code&gt;, or any GraalJS factory when &lt;code dir=&quot;auto&quot;&gt;-Drulii.script.graaljs.reuseContexts=true&lt;/code&gt;, keeps a pool of contexts instead, and the same condition runs about 160,000 times a second.&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;ScriptProcessorManager&lt;/span&gt;&lt;span&gt;.getInstance().register(&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; GraalJsScriptProcessorFactory(&lt;/span&gt;&lt;span&gt;&quot;js&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;&quot;ctx&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;GraalJsPoolOptions&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;DEFAULT&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;It is opt-in. With reuse on, a script gives what it gives without it: what it declares ends with it, and a global it leaves behind is removed before the context is used again. The one thing not undone is a change made inside a built-in (&lt;code dir=&quot;auto&quot;&gt;String.prototype.shout = ...&lt;/code&gt;), which later scripts in that context see until it is retired. That is why reuse is not the default. See &lt;a href=&quot;https://rulii.org/advanced/scripting/#whats-new-in-230-graaljs-context-reuse&quot;&gt;Scripting Support&lt;/a&gt;, which also has a note on doing the same for another script engine.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;a-flow-level-exception-handler-lets-the-flow-continue&quot;&gt;A flow-level exception handler lets the flow continue&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;RuleFlow.builder().onException(type, body)&lt;/code&gt; now recovers the failed step and the flow continues with the next top-level step, as its Javadoc always said. Up to 2.2.0 the handler body ran and the flow then ended, skipping every remaining step, while a step-level handler let the flow carry on.&lt;/p&gt;
&lt;p&gt;A failure inside a &lt;code dir=&quot;auto&quot;&gt;when&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;forEach&lt;/code&gt; or &lt;code dir=&quot;auto&quot;&gt;scope&lt;/code&gt; leaves that container first: the rest of the container is abandoned and the flow resumes with the step after it. To keep the old behaviour, end the handler body with &lt;code dir=&quot;auto&quot;&gt;exit()&lt;/code&gt;. A failure the handler’s type does not match, and a failure of the handler body, still propagate, and the finalizer still runs. See &lt;a href=&quot;https://rulii.org/core/ruleflow/#exception-handling&quot;&gt;Exception Handling&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;input-defaults-belong-to-the-run&quot;&gt;Input defaults belong to the run&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The default value of an optional input parameter of a rule flow or rule set (&lt;code dir=&quot;auto&quot;&gt;param(name, type, defaultValue)&lt;/code&gt;) is now bound in the flow’s or rule set’s own scope and goes with it. Up to 2.2.0 it was bound in the caller’s scope, so it stayed behind after the run, and the next run in the same context found the parameter bound and did not evaluate the default again. A default meant to be fresh on every run (a new collector, a timestamp) was computed once.&lt;/p&gt;
&lt;p&gt;Now every run evaluates its defaults, and the caller’s bindings are untouched. Code that read a defaulted input from the context after the run must bind the value itself first, or return it with &lt;code dir=&quot;auto&quot;&gt;returning(...)&lt;/code&gt; or &lt;code dir=&quot;auto&quot;&gt;resultExtractor(...)&lt;/code&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;a-context-built-over-another-contexts-bindings&quot;&gt;A context built over another context’s bindings&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;RuleContext.builder().build(other.getBindings())&lt;/code&gt;, and with it &lt;code dir=&quot;auto&quot;&gt;rule.run(bindings)&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;ruleSet.run(bindings)&lt;/code&gt; or &lt;code dir=&quot;auto&quot;&gt;flow.run(bindings)&lt;/code&gt; called from an action with the bindings it was handed, builds a new context over another context’s bindings. Those bindings carry the other context’s reserved &lt;code dir=&quot;auto&quot;&gt;ruleContext&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;bindings&lt;/code&gt;, and up to 2.2.0 they were found before the new context’s own. A rule in the new context that asked for its &lt;code dir=&quot;auto&quot;&gt;RuleContext&lt;/code&gt; received the older one, which knows nothing of the scopes pushed on the new one.&lt;/p&gt;
&lt;p&gt;In 2.3.0 the new context resolves &lt;code dir=&quot;auto&quot;&gt;ruleContext&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;bindings&lt;/code&gt; to itself. Everything else in the given bindings passes through as before, binds included, so a rule run this way still binds where the caller reads.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;validation&quot;&gt;Validation&lt;/h2&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code dir=&quot;auto&quot;&gt;ValueValidationRule.check(ruleContext, value)&lt;/code&gt; decides a value the caller already holds: &lt;code dir=&quot;auto&quot;&gt;PASS&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;FAIL&lt;/code&gt; or &lt;code dir=&quot;auto&quot;&gt;SKIPPED&lt;/code&gt;, with the null handling and the supported-type test a run of the rule applies, and nothing else. &lt;code dir=&quot;auto&quot;&gt;buildViolation(ruleContext, value)&lt;/code&gt; builds the violation the rule reports. They are for callers that run many validators against values they have already read; rulii-bean-validation 1.1.0 is the first.&lt;/li&gt;
&lt;li&gt;The &lt;code dir=&quot;auto&quot;&gt;decimal&lt;/code&gt; validator no longer accepts leading or trailing spaces unless asked to with &lt;code dir=&quot;auto&quot;&gt;allowSpace()&lt;/code&gt;. Its builder started with the setting on, so the strict check could not be had.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;&lt;h2 id=&quot;rulii-spring-230&quot;&gt;rulii-spring 2.3.0&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Bean Validation on rulii is opt-in.&lt;/strong&gt; rulii-bean-validation is now an optional dependency of rulii-spring and no longer comes with it. Add &lt;code dir=&quot;auto&quot;&gt;org.rulii:rulii-bean-validation&lt;/code&gt; and rulii becomes the application’s &lt;code dir=&quot;auto&quot;&gt;Validator&lt;/code&gt;, in place of Hibernate Validator; adding it is the switch. &lt;code dir=&quot;auto&quot;&gt;rulii.validation.enabled=false&lt;/code&gt; turns it off again while the dependency stays. In 2.2.0 the library came with rulii-spring and was on by default, which meant adding rulii-spring for its rules also changed how an application validated. That is now a decision the application makes.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;JPA is not affected.&lt;/strong&gt; Spring Boot does not hand its &lt;code dir=&quot;auto&quot;&gt;Validator&lt;/code&gt; to JPA; Hibernate builds one of its own from the first provider on the classpath. While Hibernate Validator is on the classpath, JPA goes on validating entities with it, whatever the dependency order. See &lt;a href=&quot;https://rulii.org/bean-validation/spring/&quot;&gt;Bean Validation in Spring Boot&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;All 48 built-in validators are XML elements.&lt;/strong&gt; The eleven validators added in rulii 2.2.0 have elements now, and every setting of a validator’s builder is an optional attribute named after the builder method:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;r:uuid&lt;/span&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;binding&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;orderId&quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;versions&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;4&quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;letterCase&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;INSENSITIVE&quot;&lt;/span&gt;&lt;span&gt;/&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;r:durationMax&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;binding&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;session&quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;max&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;PT8H&quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;inclusive&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;false&quot;&lt;/span&gt;&lt;span&gt;/&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;r:pattern&lt;/span&gt;&lt;span&gt;     &lt;/span&gt;&lt;span&gt;binding&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;notes&quot;&lt;/span&gt;&lt;span&gt;   &lt;/span&gt;&lt;span&gt;pattern&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;a.b&quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;flags&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;DOTALL,CASE_INSENSITIVE&quot;&lt;/span&gt;&lt;span&gt;/&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;See &lt;a href=&quot;https://rulii.org/spring/xml-rules/#validator-settings-as-attributes-new-in-230&quot;&gt;XML Rule Definitions&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Jakarta EL as &lt;code dir=&quot;auto&quot;&gt;${...}&lt;/code&gt;.&lt;/strong&gt; rulii-spring resolves Spring property placeholders in script text before it is compiled, and in 2.2.0 that included Jakarta EL, so an &lt;code dir=&quot;auto&quot;&gt;@Expr&lt;/code&gt; written as &lt;code dir=&quot;auto&quot;&gt;${...}&lt;/code&gt; failed with a &lt;code dir=&quot;auto&quot;&gt;PlaceholderResolutionException&lt;/code&gt;. From 2.3.0 a scripting language can opt out of the resolver, and Jakarta EL does: &lt;code dir=&quot;auto&quot;&gt;${...}&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;#{...}&lt;/code&gt; both work.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;released-with-it&quot;&gt;Released with it&lt;/h2&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://rulii.org/blog/rulii-bean-validation-1-1-0/&quot;&gt;rulii-bean-validation 1.1.0&lt;/a&gt;&lt;/strong&gt; requires rulii 2.3.0. Predefined constraints are checked directly, and a class with nothing else needs no engine around it: a bean of ten satisfied constraints validates about 640,000 times a second where 1.0.0 managed 34,000.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://rulii.org/blog/rulii-explorer-1-2-0/&quot;&gt;rulii-explorer 1.2.0&lt;/a&gt;&lt;/strong&gt; requires rulii 2.3.0 and rulii-spring 2.3.0. It starts in an application on WebFlux without Spring MVC, a start-up warning is gone, and its Beans section needs rulii-bean-validation in the application, now that the library is opt-in.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://rulii.org/blog/rulii-bom-2-3-0/&quot;&gt;rulii-bom 2.3.0&lt;/a&gt;&lt;/strong&gt; pins all four at these versions.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;&lt;h2 id=&quot;behaviour-changes&quot;&gt;Behaviour changes&lt;/h2&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;rulii-spring:&lt;/strong&gt; rulii-bean-validation no longer comes with rulii-spring. Upgrading from 2.2: add the dependency to keep validating with rulii.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rule flows:&lt;/strong&gt; a flow-level exception handler recovers the failed step and the flow continues. End the handler body with &lt;code dir=&quot;auto&quot;&gt;exit()&lt;/code&gt; (&lt;code dir=&quot;auto&quot;&gt;&amp;#x3C;r:exit/&gt;&lt;/code&gt; in XML) to stop the flow as before.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rule flows and rule sets:&lt;/strong&gt; the default of an optional input parameter is bound in the run’s own scope and is not left in the caller’s bindings.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rule context:&lt;/strong&gt; a context built over another context’s bindings resolves &lt;code dir=&quot;auto&quot;&gt;ruleContext&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;bindings&lt;/code&gt; to itself. A binding made through them inside a rule set or flow run this way lands in that rule set’s or flow’s scope and goes with it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Validation:&lt;/strong&gt; &lt;code dir=&quot;auto&quot;&gt;decimal&lt;/code&gt; rejects surrounding spaces unless &lt;code dir=&quot;auto&quot;&gt;allowSpace()&lt;/code&gt; is set; &lt;code dir=&quot;auto&quot;&gt;&amp;#x3C;r:decimal&gt;&lt;/code&gt; and rulii-bean-validation’s &lt;code dir=&quot;auto&quot;&gt;@Decimal&lt;/code&gt; follow.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scripting:&lt;/strong&gt; a Spring property placeholder inside a &lt;code dir=&quot;auto&quot;&gt;jakarta-el&lt;/code&gt; script is no longer resolved; pass the value in as a binding.&lt;/li&gt;
&lt;li&gt;&lt;code dir=&quot;auto&quot;&gt;org.rulii.spring.validation.BeanValidationOptOutConfig&lt;/code&gt; is renamed &lt;code dir=&quot;auto&quot;&gt;HibernateValidatorConfig&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
</content:encoded><category>release</category><category>rulii</category><category>rulii-spring</category></item><item><title>rulii-bean-validation 1.1.0</title><link>https://rulii.org/blog/rulii-bean-validation-1-1-0/</link><guid isPermaLink="true">https://rulii.org/blog/rulii-bean-validation-1-1-0/</guid><description>A validation call costs a fraction of what it did: predefined constraints are checked directly, and a class with nothing else needs no engine around it. The annotations, the API and the violations are unchanged.</description><pubDate>Tue, 01 Dec 2026 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;rulii-bean-validation 1.1.0 is on &lt;a href=&quot;https://central.sonatype.com/artifact/org.rulii/rulii-bean-validation/1.1.0&quot;&gt;Maven Central&lt;/a&gt;. It requires rulii 2.3.0; 1.0.0 runs on rulii 2.2.0. The annotations, the API and the violations are unchanged. This release is about what a validation call costs. The full list is in the &lt;a href=&quot;https://github.com/algox/rulii-bean-validation/blob/develop/change-log.md&quot;&gt;changelog&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;predefined-constraints-are-checked-directly&quot;&gt;Predefined constraints are checked directly&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;In 1.0.0 every constraint ran through the rule engine: parameters were matched, a value function was resolved, the rule was run. For &lt;code dir=&quot;auto&quot;&gt;@NotNull&lt;/code&gt; on a field that is a lot of machinery around one comparison.&lt;/p&gt;
&lt;p&gt;In 1.1.0 a rule backed by one of rulii’s own validators (&lt;code dir=&quot;auto&quot;&gt;@NotNull&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@Size&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@Min&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@Email&lt;/code&gt; and the rest of the standard and library constraints) is asked directly: the value is read, the validator decides, and a failure is reported with the violation the rule builds. Everything that is a rulii feature still runs in the engine, in declaration order with the rest: &lt;code dir=&quot;auto&quot;&gt;@Expr&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@Validate&lt;/code&gt;, a &lt;code dir=&quot;auto&quot;&gt;@ReportAsSingleViolation&lt;/code&gt; composition and a custom &lt;code dir=&quot;auto&quot;&gt;ConstraintValidator&lt;/code&gt;. The violations arrive in the same order, and a fail-fast call stops at the same rule.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;a-plain-class-needs-no-engine-around-it&quot;&gt;A plain class needs no engine around it&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;A class with nothing but predefined constraints on its properties is validated without bindings and without a rule flow: &lt;code dir=&quot;auto&quot;&gt;validate&lt;/code&gt; reads each property once and asks the validators. A cascade does the same when it reaches an object of such a class. A class that declares nothing to validate returns its empty report at once, and a cascade does not descend into it.&lt;/p&gt;
&lt;p&gt;Groups, group sequences, fail-fast and the traversable resolver apply as before.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-it-adds-up-to&quot;&gt;What it adds up to&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Validations per second on one thread, measured with JMH on one machine, each release from Maven Central:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What is validated&lt;/th&gt;
&lt;th&gt;1.0.0 on rulii 2.2.0&lt;/th&gt;
&lt;th&gt;1.1.0 on rulii 2.3.0&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A bean of ten satisfied constraints&lt;/td&gt;
&lt;td&gt;34,000&lt;/td&gt;
&lt;td&gt;640,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The same bean with three violations&lt;/td&gt;
&lt;td&gt;27,000&lt;/td&gt;
&lt;td&gt;160,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;An order cascading into ten lines&lt;/td&gt;
&lt;td&gt;4,400&lt;/td&gt;
&lt;td&gt;120,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;An order cascading into a hundred lines&lt;/td&gt;
&lt;td&gt;590&lt;/td&gt;
&lt;td&gt;23,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A bean with one custom &lt;code dir=&quot;auto&quot;&gt;ConstraintValidator&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;220,000&lt;/td&gt;
&lt;td&gt;800,000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Part of the gain is rulii 2.3.0 itself, which made the engine faster; the rest is this release. Two rows show where the engine still does the work: a class with a custom validator keeps its flow, and every violation is built, rendered and stamped with its path when it is reported. &lt;a href=&quot;https://rulii.org/blog/optimizing-rulii/&quot;&gt;Optimizing rulii&lt;/a&gt; has the engine’s side of it.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-a-listener-sees&quot;&gt;What a listener sees&lt;/h2&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code dir=&quot;auto&quot;&gt;RuleListener&lt;/code&gt; still sees every rule, with the same events.&lt;/li&gt;
&lt;li&gt;A &lt;code dir=&quot;auto&quot;&gt;RuleSetListener&lt;/code&gt; no longer hears from a validation call: the rules of a bean are not run as a rule set any more.&lt;/li&gt;
&lt;li&gt;A &lt;code dir=&quot;auto&quot;&gt;RuleFlowListener&lt;/code&gt; hears of the flows that actually run, so not of a plain object or one with nothing to validate.&lt;/li&gt;
&lt;li&gt;&lt;code dir=&quot;auto&quot;&gt;validateIn&lt;/code&gt;, and a bean flow run on its own, are not affected: there every object’s flow runs and is traced.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;&lt;h2 id=&quot;behaviour-changes&quot;&gt;Behaviour changes&lt;/h2&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;A bean flow run on its own keeps its defaults to itself.&lt;/strong&gt; A flow from &lt;code dir=&quot;auto&quot;&gt;getRuleFlow&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;getParametersRuleFlow&lt;/code&gt; or &lt;code dir=&quot;auto&quot;&gt;getReturnValueRuleFlow&lt;/code&gt;, run by your code without a &lt;code dir=&quot;auto&quot;&gt;ruleViolations&lt;/code&gt; collector bound, used to leave its defaulted collector in your bindings. rulii 2.3.0 binds a flow’s defaults in the flow’s own scope, so bind a &lt;code dir=&quot;auto&quot;&gt;RuleViolations&lt;/code&gt; (a &lt;code dir=&quot;auto&quot;&gt;BeanRuleViolations&lt;/code&gt; for property paths and root beans) as &lt;code dir=&quot;auto&quot;&gt;ruleViolations&lt;/code&gt; before running the flow, and read the report from it. &lt;code dir=&quot;auto&quot;&gt;validate&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;validateIn&lt;/code&gt; and the Spring integration bind their own collector and are not affected.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code dir=&quot;auto&quot;&gt;@Decimal&lt;/code&gt; no longer accepts leading or trailing spaces&lt;/strong&gt; unless &lt;code dir=&quot;auto&quot;&gt;allowSpace = true&lt;/code&gt;. The attribute was always documented as false by default; rulii’s &lt;code dir=&quot;auto&quot;&gt;decimal&lt;/code&gt; validator started with the setting on up to 2.2.0.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Two collectors in one context.&lt;/strong&gt; When a &lt;code dir=&quot;auto&quot;&gt;RuleViolations&lt;/code&gt; is bound as &lt;code dir=&quot;auto&quot;&gt;ruleViolations&lt;/code&gt; and another under a different name, &lt;code dir=&quot;auto&quot;&gt;validateIn&lt;/code&gt; and an embedded bean flow report to the one bound as &lt;code dir=&quot;auto&quot;&gt;ruleViolations&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;&lt;h2 id=&quot;jakarta-el-as--under-spring&quot;&gt;Jakarta EL as &lt;code dir=&quot;auto&quot;&gt;${...}&lt;/code&gt; under Spring&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;An &lt;code dir=&quot;auto&quot;&gt;@Expr&lt;/code&gt; or &lt;code dir=&quot;auto&quot;&gt;@Bind(expr = ...)&lt;/code&gt; in Jakarta EL written as &lt;code dir=&quot;auto&quot;&gt;${...}&lt;/code&gt; now works with rulii-spring, as &lt;code dir=&quot;auto&quot;&gt;#{...}&lt;/code&gt; always did. With rulii 2.2.0 the expression was taken for a Spring property placeholder and failed. See &lt;a href=&quot;https://rulii.org/bean-validation/spring/#jakarta-el-in-expr-and-bind&quot;&gt;Jakarta EL in @Expr and @Bind&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;spring-boot&quot;&gt;Spring Boot&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;With &lt;a href=&quot;https://rulii.org/blog/rulii-2-3-0/&quot;&gt;rulii-spring 2.3.0&lt;/a&gt; this library is opt-in: add it beside rulii-spring and it becomes the application’s &lt;code dir=&quot;auto&quot;&gt;Validator&lt;/code&gt;. rulii-spring 2.2.0 brought it in itself. See &lt;a href=&quot;https://rulii.org/bean-validation/spring/&quot;&gt;Spring Boot Integration&lt;/a&gt;.&lt;/p&gt;
</content:encoded><category>release</category><category>rulii-bean-validation</category></item><item><title>rulii-bom 2.3.0</title><link>https://rulii.org/blog/rulii-bom-2-3-0/</link><guid isPermaLink="true">https://rulii.org/blog/rulii-bom-2-3-0/</guid><description>The bill of materials for the 2.3.0 line: rulii 2.3.0, rulii-spring 2.3.0, rulii-bean-validation 1.1.0 and rulii-explorer 1.2.0.</description><pubDate>Tue, 01 Dec 2026 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;org.rulii:rulii-bom&lt;/code&gt; 2.3.0 is on &lt;a href=&quot;https://central.sonatype.com/artifact/org.rulii/rulii-bom/2.3.0&quot;&gt;Maven Central&lt;/a&gt;. It pins the versions of the rulii libraries that go together in the 2.3.0 line.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Library&lt;/th&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;rulii&lt;/td&gt;
&lt;td&gt;2.3.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;rulii-spring&lt;/td&gt;
&lt;td&gt;2.3.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;rulii-bean-validation&lt;/td&gt;
&lt;td&gt;1.1.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;rulii-explorer (core, ui, Spring Boot starter)&lt;/td&gt;
&lt;td&gt;1.2.0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Import it once, then declare the libraries you use without versions:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;dependencyManagement&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;dependencies&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;&amp;#x3C;dependency&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&amp;#x3C;groupId&gt;&lt;/span&gt;&lt;span&gt;org.rulii&lt;/span&gt;&lt;span&gt;&amp;#x3C;/groupId&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&amp;#x3C;artifactId&gt;&lt;/span&gt;&lt;span&gt;rulii-bom&lt;/span&gt;&lt;span&gt;&amp;#x3C;/artifactId&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&amp;#x3C;version&gt;&lt;/span&gt;&lt;span&gt;2.3.0&lt;/span&gt;&lt;span&gt;&amp;#x3C;/version&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&amp;#x3C;type&gt;&lt;/span&gt;&lt;span&gt;pom&lt;/span&gt;&lt;span&gt;&amp;#x3C;/type&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&amp;#x3C;scope&gt;&lt;/span&gt;&lt;span&gt;import&lt;/span&gt;&lt;span&gt;&amp;#x3C;/scope&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;&amp;#x3C;/dependency&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;/dependencies&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;/dependencyManagement&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;implementation &lt;/span&gt;&lt;span&gt;platform(&lt;/span&gt;&lt;span&gt;&apos;org.rulii:rulii-bom:2.3.0&apos;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;implementation &lt;/span&gt;&lt;span&gt;&apos;org.rulii:rulii-spring&apos;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;h2 id=&quot;one-thing-to-do-when-moving-from-bom-220&quot;&gt;One thing to do when moving from BOM 2.2.0&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;rulii-spring 2.2.0 brought rulii-bean-validation in itself. From 2.3.0 it is an optional dependency, so an application that validates its beans with rulii declares it:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;dependency&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;groupId&gt;&lt;/span&gt;&lt;span&gt;org.rulii&lt;/span&gt;&lt;span&gt;&amp;#x3C;/groupId&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;artifactId&gt;&lt;/span&gt;&lt;span&gt;rulii-bean-validation&lt;/span&gt;&lt;span&gt;&amp;#x3C;/artifactId&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;/dependency&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;The BOM manages the version. Without the dependency the application validates as Spring Boot sets it up. See &lt;a href=&quot;https://rulii.org/bean-validation/spring/&quot;&gt;Bean Validation in Spring Boot&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;What changed in the libraries themselves is in &lt;a href=&quot;https://rulii.org/blog/rulii-2-3-0/&quot;&gt;rulii 2.3.0 and rulii-spring 2.3.0&lt;/a&gt;, &lt;a href=&quot;https://rulii.org/blog/rulii-bean-validation-1-1-0/&quot;&gt;rulii-bean-validation 1.1.0&lt;/a&gt; and &lt;a href=&quot;https://rulii.org/blog/rulii-explorer-1-2-0/&quot;&gt;rulii-explorer 1.2.0&lt;/a&gt;. Full details on the &lt;a href=&quot;https://rulii.org/getting-started/installation/#using-the-bom&quot;&gt;installation page&lt;/a&gt;.&lt;/p&gt;
</content:encoded><category>release</category><category>rulii-bom</category></item><item><title>rulii-explorer 1.2.0</title><link>https://rulii.org/blog/rulii-explorer-1-2-0/</link><guid isPermaLink="true">https://rulii.org/blog/rulii-explorer-1-2-0/</guid><description>The explorer starts in an application on WebFlux without Spring MVC, a start-up warning is gone, and it is built against rulii 2.3.0 and rulii-spring 2.3.0.</description><pubDate>Tue, 01 Dec 2026 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;rulii-explorer 1.2.0 is on Maven Central as &lt;code dir=&quot;auto&quot;&gt;org.rulii:rulii-explorer-spring-boot-starter&lt;/code&gt;. It requires rulii 2.3.0 and rulii-spring 2.3.0, and the Beans section needs rulii-bean-validation 1.1.0. It is a release of fixes; what the explorer shows is unchanged. The full list is in the &lt;a href=&quot;https://github.com/algox/rulii-explorer/blob/develop/CHANGELOG.md&quot;&gt;change log&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;an-application-on-webflux-without-spring-mvc-starts&quot;&gt;An application on WebFlux without Spring MVC starts&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;In 1.0.0 and 1.1.0 an application that had WebFlux and no Spring MVC did not start when the explorer’s page was on, which is the default. Start-up ended in:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;NoClassDefFoundError: org/springframework/web/servlet/config/annotation/WebMvcConfigurer&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;The WebFlux configuration read a setting kept in the Spring MVC one, and that class cannot be loaded without Spring MVC. An application with both web stacks on its classpath never saw it, and neither did the explorer’s tests, which had both. The setting has moved to a place of its own, and the tests now also run once with each web stack taken off the classpath.&lt;/p&gt;
&lt;p&gt;If you have to stay on 1.1.0 for now, &lt;code dir=&quot;auto&quot;&gt;rulii.explorer.ui.enabled=false&lt;/code&gt; avoids the failure: the descriptor endpoint works and the page is not served.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;a-warning-at-start-up-is-gone&quot;&gt;A warning at start-up is gone&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;An application with one web stack logged this at start-up:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;Failed to introspect meta-annotation @Import on class ...RuliiExplorerAutoConfiguration: TypeNotPresentException&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;It was harmless, and it is gone. &lt;code dir=&quot;auto&quot;&gt;UiMvcConfiguration&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;UiWebFluxConfiguration&lt;/code&gt; are now auto-configurations of their own, applied after &lt;code dir=&quot;auto&quot;&gt;RuliiExplorerAutoConfiguration&lt;/code&gt;. When the page is served has not changed.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;built-against-rulii-230&quot;&gt;Built against rulii 2.3.0&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;In &lt;a href=&quot;https://rulii.org/blog/rulii-2-3-0/&quot;&gt;rulii-spring 2.3.0&lt;/a&gt; Bean Validation on rulii is opt-in: rulii-bean-validation no longer comes with rulii-spring. The explorer follows. Its Beans section (&lt;code dir=&quot;auto&quot;&gt;rulii.explorer.beans.enabled=true&lt;/code&gt;) needs the library in the application, which is also what makes rulii the application’s &lt;code dir=&quot;auto&quot;&gt;Validator&lt;/code&gt;:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;dependency&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;groupId&gt;&lt;/span&gt;&lt;span&gt;org.rulii&lt;/span&gt;&lt;span&gt;&amp;#x3C;/groupId&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;artifactId&gt;&lt;/span&gt;&lt;span&gt;rulii-bean-validation&lt;/span&gt;&lt;span&gt;&amp;#x3C;/artifactId&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;version&gt;&lt;/span&gt;&lt;span&gt;1.1.0&lt;/span&gt;&lt;span&gt;&amp;#x3C;/version&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;/dependency&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Without it the section stays off, as it does with &lt;code dir=&quot;auto&quot;&gt;rulii.validation.enabled=false&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The descriptor now carries the rulii version the application runs on (&lt;code dir=&quot;auto&quot;&gt;ruliiVersion&lt;/code&gt;), which read “unknown” on rulii 2.2.0.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;getting-it&quot;&gt;Getting it&lt;/h2&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;dependency&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;groupId&gt;&lt;/span&gt;&lt;span&gt;org.rulii&lt;/span&gt;&lt;span&gt;&amp;#x3C;/groupId&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;artifactId&gt;&lt;/span&gt;&lt;span&gt;rulii-explorer-spring-boot-starter&lt;/span&gt;&lt;span&gt;&amp;#x3C;/artifactId&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;version&gt;&lt;/span&gt;&lt;span&gt;1.2.0&lt;/span&gt;&lt;span&gt;&amp;#x3C;/version&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;/dependency&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Or import &lt;a href=&quot;https://rulii.org/blog/rulii-bom-2-3-0/&quot;&gt;rulii-bom 2.3.0&lt;/a&gt;, which pins it with the matching rulii, rulii-spring and rulii-bean-validation.&lt;/p&gt;
</content:encoded><category>release</category><category>rulii-explorer</category></item><item><title>You keep the rules, the AI keeps the rest</title><link>https://rulii.org/blog/using-ai-to-build-the-rules/</link><guid isPermaLink="true">https://rulii.org/blog/using-ai-to-build-the-rules/</guid><description>Keeping the business rules apart from the rest of the code used to take discipline, planning and buy-in. Now it takes one instruction. The AI writes the code, and you keep the rules.</description><pubDate>Wed, 11 Nov 2026 13:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Keeping the business rules apart from the rest of the code was never a technical problem. It was a discipline problem.&lt;/p&gt;
&lt;p&gt;You had to plan for it. Domain-Driven Design helped, because it gave the rules somewhere to belong. And you needed buy-in from the developers, all of them, on every change. That was the hard part. The buy-in was real, and it lasted until the first deadline. Then somebody put an if statement in a service, just this once, and it’s still there.&lt;/p&gt;
&lt;p&gt;With AI this gets a lot easier. Not because the AI knows better than we did. It just does what you ask, every time, including on a Friday afternoon.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;left-alone-the-ai-buries-them-too&quot;&gt;Left alone, the AI buries them too&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;I took a small order service, with no rulii and no instructions, and asked Claude Code for one thing: add free shipping for gold customers on orders of 100 or more. This is what it changed:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;@Component&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;class&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;ShippingRates&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;static&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;final&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;BigDecimal&lt;/span&gt;&lt;span&gt; FLAT_RATE &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;BigDecimal&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;9.95&quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;static&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;final&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;BigDecimal&lt;/span&gt;&lt;span&gt; GOLD_FREE_SHIPPING_MINIMUM &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;BigDecimal&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;100&quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;BigDecimal&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;quote&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;Order&lt;/span&gt;&lt;span&gt; order, &lt;/span&gt;&lt;span&gt;Customer&lt;/span&gt;&lt;span&gt; customer) {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;if&lt;/span&gt;&lt;span&gt; (customer&lt;/span&gt;&lt;span&gt;.getTier()&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;==&lt;/span&gt;&lt;span&gt; Tier.GOLD&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                &lt;/span&gt;&lt;span&gt;&amp;#x26;&amp;#x26;&lt;/span&gt;&lt;span&gt; order&lt;/span&gt;&lt;span&gt;.getTotal().compareTo(GOLD_FREE_SHIPPING_MINIMUM)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;) {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; BigDecimal.ZERO;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; FLAT_RATE;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;It works, and it wrote the tests to prove it. It’s also exactly what we used to do, which isn’t a surprise. It learned from us.&lt;/p&gt;
&lt;p&gt;The rule is now one condition inside the class that quotes shipping rates. That’s a perfectly reasonable place for it, which is the problem. The next rule will go somewhere just as reasonable, and somewhere else. The only real difference is the speed. What took a team a few years now takes an afternoon.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;ask-for-the-rules-to-be-kept-apart&quot;&gt;Ask for the rules to be kept apart&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The fix is an instruction, written once, in the file your assistant reads before every task. For Claude Code that’s &lt;code dir=&quot;auto&quot;&gt;CLAUDE.md&lt;/code&gt;:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;## Business rules&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;- A business rule is a rulii rule: one rule per class, in &lt;/span&gt;&lt;span&gt;`com.acme.orders.rules`&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;- Every rule has a name, a description in plain English and a category.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;- Services don&apos;t decide anything. They run a rule set and act on the result.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;- Every rule gets a test of its own.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;That’s the buy-in. It used to take a workshop.&lt;/p&gt;
&lt;p&gt;I added rulii to the build, copied in the skills (they’re next), put those four lines in, and asked for the same feature in the same words. This time the decision came back on its own:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;@Rule(&lt;/span&gt;&lt;span&gt;&quot;GoldFreeShippingRule&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;@Description(&lt;/span&gt;&lt;span&gt;&quot;Gold customers get free shipping on orders of 100 or more.&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;@Category(&lt;/span&gt;&lt;span&gt;&quot;Shipping&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;class&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;GoldFreeShippingRule&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;static&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;final&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;BigDecimal&lt;/span&gt;&lt;span&gt; MINIMUM_TOTAL &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;BigDecimal&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;100&quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;@Given&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;boolean&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;when&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;Customer&lt;/span&gt;&lt;span&gt; customer, &lt;/span&gt;&lt;span&gt;Order&lt;/span&gt;&lt;span&gt; order) {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; customer&lt;/span&gt;&lt;span&gt;.getTier()&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;==&lt;/span&gt;&lt;span&gt; Tier.GOLD &lt;/span&gt;&lt;span&gt;&amp;#x26;&amp;#x26;&lt;/span&gt;&lt;span&gt; order&lt;/span&gt;&lt;span&gt;.getTotal().compareTo(MINIMUM_TOTAL)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;@Then&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;void&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;then&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;Order&lt;/span&gt;&lt;span&gt; order) {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span&gt;order&lt;/span&gt;&lt;span&gt;.setShipping(&lt;/span&gt;&lt;span&gt;BigDecimal&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;ZERO&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;With it came a &lt;code dir=&quot;auto&quot;&gt;shippingRules&lt;/code&gt; rule set, and a service that’s back to being plumbing. I’ve shortened the call it wrote to rulii’s one-line form:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;Order&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;place&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;OrderRequest&lt;/span&gt;&lt;span&gt; request) {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;Customer&lt;/span&gt;&lt;span&gt; buyer &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; customers&lt;/span&gt;&lt;span&gt;.find(&lt;/span&gt;&lt;span&gt;request&lt;/span&gt;&lt;span&gt;.getCustomerId())&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;Order&lt;/span&gt;&lt;span&gt; newOrder &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; Order&lt;/span&gt;&lt;span&gt;.from(request)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;newOrder&lt;/span&gt;&lt;span&gt;.setShipping(&lt;/span&gt;&lt;span&gt;rates&lt;/span&gt;&lt;span&gt;.quote(newOrder))&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;shippingRules&lt;/span&gt;&lt;span&gt;.run(customer &lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt; buyer, order &lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt; newOrder)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; orders&lt;/span&gt;&lt;span&gt;.save(newOrder)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;It no longer knows what a gold customer is, or what the threshold is. It asks.&lt;/p&gt;
&lt;p&gt;I also tried it with rulii in the build and no instruction at all. It wrote a rule anyway, because the library was sitting there unused, and it said so. But that rule had no category, wasn’t in a rule set and had no test of its own. The assistant will take a hint. The instruction is what got the rest.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-skills-are-already-written&quot;&gt;The skills are already written&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;You don’t have to teach your assistant rulii. The repositories ship with Claude Code skills that do it:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Skill&lt;/th&gt;
&lt;th&gt;What it covers&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code dir=&quot;auto&quot;&gt;/new-rule&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A rule as a class or a lambda: conditions, actions, otherwise, pre-conditions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code dir=&quot;auto&quot;&gt;/new-ruleset&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rule sets: ordering, lifecycle hooks, stop conditions, validating mode&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code dir=&quot;auto&quot;&gt;/new-ruleflow&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rule flows: steps, decisions, loops, async, exception handling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code dir=&quot;auto&quot;&gt;/new-validation-rule&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A custom validation rule and its builder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code dir=&quot;auto&quot;&gt;/new-xml-ruleset&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rules, rule sets and validators in Spring XML&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code dir=&quot;auto&quot;&gt;/new-xml-ruleflow&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rule flows in Spring XML&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code dir=&quot;auto&quot;&gt;/write-test&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Tests for PASS, FAIL and SKIP, with and without Spring&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code dir=&quot;auto&quot;&gt;/debug-rule&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Why a rule didn’t fire, or fired when it shouldn’t have&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The first four, with the test and debug skills, are in &lt;a href=&quot;https://github.com/algox/rulii/tree/develop/.claude/skills&quot;&gt;rulii&lt;/a&gt;. &lt;a href=&quot;https://github.com/algox/rulii-spring/tree/develop/.claude/skills&quot;&gt;rulii-spring&lt;/a&gt; has its own versions that know about Spring wiring, plus the two XML ones. If you’re on Spring Boot, take the rulii-spring set and add &lt;code dir=&quot;auto&quot;&gt;/new-ruleflow&lt;/code&gt; from rulii.&lt;/p&gt;
&lt;p&gt;Copy them into your project and Claude Code finds them on its own:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;cp&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;-r&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;#x3C;path-to-rulii-spring&gt;/.claude/skills/&lt;/span&gt;&lt;span&gt;*&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;.claude/skills/&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;cp&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;-r&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;#x3C;path-to-rulii&gt;/.claude/skills/new-ruleflow&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;.claude/skills/&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Each one is a Markdown file, so an assistant that isn’t Claude can be pointed at it too. The documentation is also published as plain text for assistants, at &lt;a href=&quot;https://rulii.org/llms.txt&quot;&gt;rulii.org/llms.txt&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;small-enough-to-read&quot;&gt;Small enough to read&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;An assistant produces a lot of code, and nobody reads all of it the way they’d read their own. A rule is different. It’s a name, a sentence and a few lines, so you can follow along.&lt;/p&gt;
&lt;p&gt;The session tested the rule five ways, including at exactly 100 and at 99.99. It started the whole application to do it, which it didn’t need to. A rule runs on its own:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;@Test&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;void&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;goldCustomerOverTheThresholdShipsFree&lt;/span&gt;&lt;span&gt;() {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;Rule&lt;/span&gt;&lt;span&gt; rule &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; Rule&lt;/span&gt;&lt;span&gt;.builder().build(&lt;/span&gt;&lt;span&gt;GoldFreeShippingRule&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;class&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;Customer&lt;/span&gt;&lt;span&gt; gold &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;Customer&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;C-200&quot;&lt;/span&gt;&lt;span&gt;, Tier.GOLD);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;Order&lt;/span&gt;&lt;span&gt; placed &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;Order&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;C-200&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;BigDecimal&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;120.00&quot;&lt;/span&gt;&lt;span&gt;));&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;placed&lt;/span&gt;&lt;span&gt;.setShipping(&lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; BigDecimal(&lt;/span&gt;&lt;span&gt;&quot;9.95&quot;&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;RuleResult&lt;/span&gt;&lt;span&gt; result &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; rule&lt;/span&gt;&lt;span&gt;.run(customer &lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt; gold, order &lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt; placed)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;assertEquals&lt;/span&gt;&lt;span&gt;(RuleExecutionStatus.PASS, result&lt;/span&gt;&lt;span&gt;.status()&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;assertEquals&lt;/span&gt;&lt;span&gt;(BigDecimal.ZERO, placed&lt;/span&gt;&lt;span&gt;.getShipping()&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;No Spring context, no database and no mocks. If the assistant gets a rule wrong, this is where you’ll see it, and it’s a dozen lines.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-explorer-shows-you-all-of-them&quot;&gt;The explorer shows you all of them&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Reading one rule is easy. Knowing what all of them are, after six months of an assistant adding them, is the other half.&lt;/p&gt;
&lt;p&gt;That’s what the &lt;a href=&quot;https://rulii.org/demo/index.html&quot;&gt;explorer&lt;/a&gt; is for. It’s a read-only viewer for the rules of a running application. Add the starter to a Spring Boot application:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;dependency&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;groupId&gt;&lt;/span&gt;&lt;span&gt;org.rulii&lt;/span&gt;&lt;span&gt;&amp;#x3C;/groupId&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;artifactId&gt;&lt;/span&gt;&lt;span&gt;rulii-explorer-spring-boot-starter&lt;/span&gt;&lt;span&gt;&amp;#x3C;/artifactId&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;version&gt;&lt;/span&gt;&lt;span&gt;1.1.0&lt;/span&gt;&lt;span&gt;&amp;#x3C;/version&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;/dependency&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;It’s off until you switch it on, so production never shows its rules by accident:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;rulii.explorer.enabled&lt;/span&gt;&lt;span&gt;=true&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;management.endpoints.web.exposure.include&lt;/span&gt;&lt;span&gt;=health,rulii&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Then open &lt;code dir=&quot;auto&quot;&gt;/rulii&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Every rule, rule set and flow gets a page: what it’s for, what it reads and writes, which rule sets and flows run it, and the file and line it lives on. Rules written as expressions or in XML are read out in plain English. A rule that’s a compiled class shows its description and its signature, which is why the instruction above asks for a description on every one.&lt;/p&gt;
&lt;p&gt;It also has a Problems page, and the list could have been written with an assistant in mind: a rule nothing runs, a step that runs something that isn’t registered, duplicate names, missing descriptions. Those are the mistakes you make when you’re moving quickly, and an assistant is always moving quickly.&lt;/p&gt;
&lt;p&gt;The same information can be written to a JSON file at build time and compared between releases. So when the assistant tells you it only tidied up the service, you can check whether a rule changed.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;who-maintains-what&quot;&gt;Who maintains what&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;You keep the rules and the AI keeps the rest. That’s the split I’d aim for.&lt;/p&gt;
&lt;p&gt;The controllers, the mappers, the repositories and the configuration are the AI’s to maintain. You review them the way you review any code, but there’s rarely anything in them the business would care about.&lt;/p&gt;
&lt;p&gt;The rules are yours. When the business changes its mind, and it will, the change is one rule. You can ask the AI to make it, and what you read afterwards is a diff of five lines with a name on it.&lt;/p&gt;
&lt;p&gt;I said on the &lt;a href=&quot;https://rulii.org/why/&quot;&gt;Why page&lt;/a&gt; that AI helped me polish, test and document rulii, and that the thinking was already done. It’s the same here. Knowing what the rules are is the hard part, and that’s still your job.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;try-it&quot;&gt;Try it&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;You don’t have to take my word for any of this. The order service I started from is in &lt;a href=&quot;https://github.com/algox/rulii-samples/tree/develop/ai-assistant-starter&quot;&gt;rulii-samples&lt;/a&gt;, with the four lines and the skills already in place. Clone it, type the same request and see what your assistant does.&lt;/p&gt;
&lt;p&gt;Or start with &lt;a href=&quot;https://rulii.org/getting-started/installation/&quot;&gt;Installation&lt;/a&gt;, add the four lines to your own &lt;code dir=&quot;auto&quot;&gt;CLAUDE.md&lt;/code&gt;, and see where the next rule ends up.&lt;/p&gt;
</content:encoded><category>ai</category><category>rulii-explorer</category></item><item><title>Why I&apos;d use rulii to validate incoming data</title><link>https://rulii.org/blog/validating-incoming-data/</link><guid isPermaLink="true">https://rulii.org/blog/validating-incoming-data/</guid><description>Bean Validation annotations cover the easy checks. The cross-field ones and the business rules are where they run out, and where a rule engine earns its place.</description><pubDate>Wed, 11 Nov 2026 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Every system I’ve worked on has to validate incoming data. It doesn’t matter whether it arrives at a REST controller or on a Kafka topic. Before you act on it, you check it.&lt;/p&gt;
&lt;p&gt;Normally we reach for Bean Validation. A few annotations on the class, &lt;code dir=&quot;auto&quot;&gt;@NotNull&lt;/code&gt; here, &lt;code dir=&quot;auto&quot;&gt;@Size&lt;/code&gt; there, and for a while that’s enough.&lt;/p&gt;
&lt;p&gt;Then the more complicated cases turn up. A date that has to come after another date. An order that can’t go over the customer’s credit limit. Cross-field edits, and plain business rules. That’s where the annotations run out, and that’s where I’d use rulii.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;where-the-annotations-stop&quot;&gt;Where the annotations stop&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;A constraint looks at one value. The moment a check needs two fields, Bean Validation asks you for a class-level annotation and a &lt;code dir=&quot;auto&quot;&gt;ConstraintValidator&lt;/code&gt; class to go with it. That’s two new types to say “the ship date can’t be before the order date”.&lt;/p&gt;
&lt;p&gt;A check that needs to ask a service something is worse. You can do it, with another annotation and a validator that has the service injected. In practice nobody does. It ends up in the service method, after the “validation” has already passed. The rule is back in the business tier, which is where we came in.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;keep-the-constraints-you-have&quot;&gt;Keep the constraints you have&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Nothing changes here. rulii-bean-validation is a Bean Validation provider, so the annotations already on your classes run as they are.&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;class&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;OrderRequest&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;@NotBlank&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;String&lt;/span&gt;&lt;span&gt; customerId;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;@NotNull&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;@Positive&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;BigDecimal&lt;/span&gt;&lt;span&gt; total;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;@NotNull&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;LocalDate&lt;/span&gt;&lt;span&gt; orderDate;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;LocalDate&lt;/span&gt;&lt;span&gt; shipDate;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;String&lt;/span&gt;&lt;span&gt; purchaseOrder;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;// getters and setters&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;h2 id=&quot;a-cross-field-check-is-one-line&quot;&gt;A cross-field check is one line&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;@Expr&lt;/code&gt; puts the condition where the field is. No validator class and no new annotation.&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;@ExprDefaults(&lt;/span&gt;&lt;span&gt;lang&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&quot;jakarta-el&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;class&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;OrderRequest&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;// ...&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;@Expr(&lt;/span&gt;&lt;span&gt;value&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&quot;#{orderDate == null || !shipDate.isBefore(orderDate)}&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;          &lt;/span&gt;&lt;span&gt;errorCode&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&quot;order.shipDate&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;          &lt;/span&gt;&lt;span&gt;message&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&quot;Ship date is before the order date&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;LocalDate&lt;/span&gt;&lt;span&gt; shipDate;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;h2 id=&quot;the-business-rules-go-in-a-rule-set&quot;&gt;The business rules go in a rule set&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;An order has rules that aren’t about its fields at all:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the customer’s account has to be active;&lt;/li&gt;
&lt;li&gt;the total can’t go over the customer’s credit limit;&lt;/li&gt;
&lt;li&gt;an order of 10,000 or more needs a purchase order number.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;None of that belongs on the class. It depends on who the customer is today, and it will change. So the class only says which rules apply, by name:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;@Validate(&lt;/span&gt;&lt;span&gt;&quot;orderRules&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;class&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;OrderRequest&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;// ...&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Two of those rules need to ask a service, so they’re classes. Spring injects what they need:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;@Rule(&lt;/span&gt;&lt;span&gt;name&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&quot;withinCreditLimit&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;class&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;WithinCreditLimit&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;final&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;Customers&lt;/span&gt;&lt;span&gt; customers;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;WithinCreditLimit&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;Customers&lt;/span&gt;&lt;span&gt; customers) {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span&gt;this.customers &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; customers;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;@Given&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;boolean&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;withinLimit&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;String&lt;/span&gt;&lt;span&gt; customerId, &lt;/span&gt;&lt;span&gt;BigDecimal&lt;/span&gt;&lt;span&gt; total) {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; total&lt;/span&gt;&lt;span&gt;.compareTo(&lt;/span&gt;&lt;span&gt;customers&lt;/span&gt;&lt;span&gt;.creditLimit(customerId))&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;#x3C;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;@Otherwise&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;void&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;report&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;RuleViolations&lt;/span&gt;&lt;span&gt; violations) {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span&gt;violations&lt;/span&gt;&lt;span&gt;.add(&lt;/span&gt;&lt;span&gt;&quot;withinCreditLimit&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;&quot;order.creditLimit&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                &lt;/span&gt;&lt;span&gt;Severity&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;ERROR&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;&quot;Order total is over the credit limit&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;The rule gets the fields of the request by name. &lt;code dir=&quot;auto&quot;&gt;CustomerIsActive&lt;/code&gt; looks the same, with a different question. You can test either one on its own, with a fake &lt;code dir=&quot;auto&quot;&gt;Customers&lt;/code&gt; and no web layer in sight.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-rule-set-in-java&quot;&gt;The rule set, in Java&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;orderRules&lt;/code&gt; is a rule set: the rules, the order they run in, and when to stop.&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;@Configuration&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;class&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;OrderRulesConfig&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;static&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;final&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;BigDecimal&lt;/span&gt;&lt;span&gt; PO_THRESHOLD &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;BigDecimal&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;10000&quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;@Bean&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;RuleSet&lt;/span&gt;&lt;span&gt;&amp;#x3C;&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;span&gt;&gt; &lt;/span&gt;&lt;span&gt;orderRules&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;@Qualifier(&lt;/span&gt;&lt;span&gt;&quot;customerIsActive&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;Rule&lt;/span&gt;&lt;span&gt; customerIsActive,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                                 &lt;/span&gt;&lt;span&gt;@Qualifier(&lt;/span&gt;&lt;span&gt;&quot;withinCreditLimit&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;Rule&lt;/span&gt;&lt;span&gt; withinCreditLimit) {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; RuleSet&lt;/span&gt;&lt;span&gt;.builder()&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                &lt;/span&gt;&lt;span&gt;.with(&lt;/span&gt;&lt;span&gt;&quot;orderRules&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;&quot;What an order has to satisfy beyond its fields&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                &lt;/span&gt;&lt;span&gt;.preCondition(condition((&lt;/span&gt;&lt;span&gt;String&lt;/span&gt;&lt;span&gt; customerId, &lt;/span&gt;&lt;span&gt;BigDecimal&lt;/span&gt;&lt;span&gt; total) &lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;                        &lt;/span&gt;&lt;/span&gt;&lt;span&gt;customerId &lt;/span&gt;&lt;span&gt;!=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;#x26;&amp;#x26;&lt;/span&gt;&lt;span&gt; total &lt;/span&gt;&lt;span&gt;!=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                &lt;/span&gt;&lt;span&gt;.stopCondition(stopWhenOneFails())&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                &lt;/span&gt;&lt;span&gt;.rule(customerIsActive)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                &lt;/span&gt;&lt;span&gt;.rule(withinCreditLimit)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                &lt;/span&gt;&lt;span&gt;.rule(assertTrue(function((&lt;/span&gt;&lt;span&gt;BigDecimal&lt;/span&gt;&lt;span&gt; total, &lt;/span&gt;&lt;span&gt;String&lt;/span&gt;&lt;span&gt; purchaseOrder) &lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                                &lt;/span&gt;&lt;span&gt;total&lt;/span&gt;&lt;span&gt;.compareTo(PO_THRESHOLD) &lt;/span&gt;&lt;span&gt;&amp;#x3C;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;||&lt;/span&gt;&lt;span&gt; purchaseOrder &lt;/span&gt;&lt;span&gt;!=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;                        &lt;/span&gt;&lt;/span&gt;&lt;span&gt;.errorCode(&lt;/span&gt;&lt;span&gt;&quot;order.purchaseOrder&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;                        &lt;/span&gt;&lt;/span&gt;&lt;span&gt;.message(&lt;/span&gt;&lt;span&gt;&quot;Orders of 10,000 or more need a purchase order&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;                        &lt;/span&gt;&lt;/span&gt;&lt;span&gt;.build())&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                &lt;/span&gt;&lt;span&gt;.build()&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;It reads top to bottom. Don’t bother unless there’s a customer and a total. Stop at the first rule that fails, because there’s no point checking the credit limit of a closed account. The third rule only looks at the data, so it’s a lambda.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-same-rule-set-in-xml&quot;&gt;The same rule set, in XML&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;If you’d rather the rules lived outside the build, this is the same rule set:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;r:ruleset&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;name&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;orderRules&quot;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;           &lt;/span&gt;&lt;span&gt;description&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;What an order has to satisfy beyond its fields&quot;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;           &lt;/span&gt;&lt;span&gt;pre-condition&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;#ctx.customerId != null and #ctx.total != null&quot;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;           &lt;/span&gt;&lt;span&gt;stop-condition&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;#ctx.ruleSetStatus.anyFail&quot;&lt;/span&gt;&lt;span&gt;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;r:rules&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;&amp;#x3C;r:bean-ref&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;name&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;customerIsActive&quot;&lt;/span&gt;&lt;span&gt;/&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;&amp;#x3C;r:bean-ref&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;name&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;withinCreditLimit&quot;&lt;/span&gt;&lt;span&gt;/&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;&amp;#x3C;r:validationRule&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;name&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;largeOrderNeedsPurchaseOrder&quot;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                          &lt;/span&gt;&lt;span&gt;errorCode&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;order.purchaseOrder&quot;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                          &lt;/span&gt;&lt;span&gt;errorMessage&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;Orders of 10,000 or more need a purchase order&quot;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                          &lt;/span&gt;&lt;span&gt;given&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;#ctx.total &amp;#x26;lt; 10000 or #ctx.purchaseOrder != null&quot;&lt;/span&gt;&lt;span&gt;/&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;/r:rules&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;/r:ruleset&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;The two rules that need a service are still the classes above, referenced by name. The purchase order rule is written out, threshold and all. When the business decides it’s 5,000, that’s a change to a file, not a rebuild. &lt;a href=&quot;https://rulii.org/spring/xml-rules/&quot;&gt;XML Rule Definitions&lt;/a&gt; has the rest of the grammar.&lt;/p&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;OrderRequest&lt;/code&gt; doesn’t know or care which of the two you chose. It asks for &lt;code dir=&quot;auto&quot;&gt;orderRules&lt;/code&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;one-call-all-of-it&quot;&gt;One call, all of it&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The constraints, the cross-field check and the rule set report through the same validator:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;Set&lt;/span&gt;&lt;span&gt;&amp;#x3C;&lt;/span&gt;&lt;span&gt;ConstraintViolation&lt;/span&gt;&lt;span&gt;&amp;#x3C;&lt;/span&gt;&lt;span&gt;OrderRequest&lt;/span&gt;&lt;span&gt;&gt;&gt; violations &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; validator&lt;/span&gt;&lt;span&gt;.validate(request)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;A negative total, shipped the day before it was ordered&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;[total] must be greater than 0&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;[shipDate] Ship date is before the order date&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;A customer whose account is closed&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;Customer account is not active&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;9,000 against a credit limit of 5,000&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;Order total is over the credit limit&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;25,000 with no purchase order&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;Orders of 10,000 or more need a purchase order&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;h2 id=&quot;the-same-check-at-every-door&quot;&gt;The same check at every door&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;In a Spring Boot application with rulii-spring and rulii-bean-validation, the &lt;code dir=&quot;auto&quot;&gt;Validator&lt;/code&gt; bean is rulii’s, so a controller doesn’t change:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;@PostMapping(&lt;/span&gt;&lt;span&gt;&quot;/orders&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;Receipt&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;place&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;@Valid&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;@RequestBody&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;OrderRequest&lt;/span&gt;&lt;span&gt; request) {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; orders&lt;/span&gt;&lt;span&gt;.place(request)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;A Kafka listener uses the same validator and the same rules:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;@KafkaListener(&lt;/span&gt;&lt;span&gt;topics&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&quot;orders&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;void&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;onOrder&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;OrderRequest&lt;/span&gt;&lt;span&gt; request) {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;Set&lt;/span&gt;&lt;span&gt;&amp;#x3C;&lt;/span&gt;&lt;span&gt;ConstraintViolation&lt;/span&gt;&lt;span&gt;&amp;#x3C;&lt;/span&gt;&lt;span&gt;OrderRequest&lt;/span&gt;&lt;span&gt;&gt;&gt; violations &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; validator&lt;/span&gt;&lt;span&gt;.validate(request)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;if&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span&gt;!&lt;/span&gt;&lt;span&gt;violations&lt;/span&gt;&lt;span&gt;.isEmpty()&lt;/span&gt;&lt;span&gt;) {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span&gt;deadLetters&lt;/span&gt;&lt;span&gt;.send(request, violations)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;orders&lt;/span&gt;&lt;span&gt;.place(request)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;One class says what a valid order is, and it holds wherever the order comes from.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;why-id-move-off-hibernate-validator&quot;&gt;Why I’d move off Hibernate Validator&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Hibernate Validator checks annotations, and it does that well. It even has &lt;code dir=&quot;auto&quot;&gt;@ScriptAssert&lt;/code&gt; for a condition across two fields. What it doesn’t have is anywhere to put a business rule: something with a name, an order and a stopping point, that you can test on its own and change without touching the class. In a Hibernate project those become hand-written validator classes, or if statements in a service.&lt;/p&gt;
&lt;p&gt;So I’d move, and it costs less than you’d think.&lt;/p&gt;
&lt;p&gt;Add rulii-bean-validation beside rulii-spring and it becomes the application’s validator. Your annotations stay as they are. The constraints Hibernate adds on top, &lt;code dir=&quot;auto&quot;&gt;@Length&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@Range&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@URL&lt;/code&gt; and the rest, are there under the same names. Your own &lt;code dir=&quot;auto&quot;&gt;ConstraintValidator&lt;/code&gt; classes keep running. Then, when you’re ready, exclude &lt;code dir=&quot;auto&quot;&gt;hibernate-validator&lt;/code&gt; from the validation starter, and it’s gone.&lt;/p&gt;
&lt;p&gt;What you get for it is one engine. The annotations and the business rules run in the same place and report the same way. Rules are attached by name and changed without touching the class. And every constraint on every bean shows up in the explorer as a rule you can read.&lt;/p&gt;
&lt;p&gt;Now the part you should know. Hibernate Validator is the reference implementation and it’s certified. rulii-bean-validation isn’t, and it doesn’t run the TCK. The differences are &lt;a href=&quot;https://rulii.org/bean-validation/spec-coverage/&quot;&gt;written down&lt;/a&gt;, chapter by chapter, and none of the known ones changes the outcome for an ordinary bean. If certification is a requirement where you work, stay where you are.&lt;/p&gt;
&lt;p&gt;If it isn’t, the &lt;a href=&quot;https://rulii.org/bean-validation/migration/&quot;&gt;migration guide&lt;/a&gt; is a checklist of seven steps, and one property puts you back if I turn out to be wrong.&lt;/p&gt;
&lt;p&gt;Start with &lt;a href=&quot;https://rulii.org/bean-validation/validating-beans/&quot;&gt;Validating Beans&lt;/a&gt;.&lt;/p&gt;
</content:encoded><category>validation</category><category>rulii-bean-validation</category></item><item><title>rulii-bom 2.2.0</title><link>https://rulii.org/blog/rulii-bom-2-2-0/</link><guid isPermaLink="true">https://rulii.org/blog/rulii-bom-2-2-0/</guid><description>A bill of materials that pins the matching versions of rulii, rulii-spring, rulii-bean-validation and rulii-explorer. Import it once and leave the versions off.</description><pubDate>Sat, 07 Nov 2026 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;org.rulii:rulii-bom&lt;/code&gt; 2.2.0 is on &lt;a href=&quot;https://central.sonatype.com/artifact/org.rulii/rulii-bom/2.2.0&quot;&gt;Maven Central&lt;/a&gt;. It is a bill of materials: a POM with no code that pins the versions of every rulii library that go together.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Library&lt;/th&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;rulii&lt;/td&gt;
&lt;td&gt;2.2.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;rulii-spring&lt;/td&gt;
&lt;td&gt;2.2.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;rulii-bean-validation&lt;/td&gt;
&lt;td&gt;1.0.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;rulii-explorer (core, ui, Spring Boot starter)&lt;/td&gt;
&lt;td&gt;1.1.0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Import it once, then declare the libraries you use without versions:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;dependencyManagement&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;dependencies&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;&amp;#x3C;dependency&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&amp;#x3C;groupId&gt;&lt;/span&gt;&lt;span&gt;org.rulii&lt;/span&gt;&lt;span&gt;&amp;#x3C;/groupId&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&amp;#x3C;artifactId&gt;&lt;/span&gt;&lt;span&gt;rulii-bom&lt;/span&gt;&lt;span&gt;&amp;#x3C;/artifactId&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&amp;#x3C;version&gt;&lt;/span&gt;&lt;span&gt;2.2.0&lt;/span&gt;&lt;span&gt;&amp;#x3C;/version&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&amp;#x3C;type&gt;&lt;/span&gt;&lt;span&gt;pom&lt;/span&gt;&lt;span&gt;&amp;#x3C;/type&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&amp;#x3C;scope&gt;&lt;/span&gt;&lt;span&gt;import&lt;/span&gt;&lt;span&gt;&amp;#x3C;/scope&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;&amp;#x3C;/dependency&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;#x3C;/dependencies&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;/dependencyManagement&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;implementation &lt;/span&gt;&lt;span&gt;platform(&lt;/span&gt;&lt;span&gt;&apos;org.rulii:rulii-bom:2.2.0&apos;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;implementation &lt;/span&gt;&lt;span&gt;&apos;org.rulii:rulii-spring&apos;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;The BOM’s version follows the core library’s, so a future rulii 2.3.0 comes with a rulii-bom 2.3.0 that pins whatever versions of the companions go with it. Full details on the &lt;a href=&quot;https://rulii.org/getting-started/installation/#using-the-bom&quot;&gt;installation page&lt;/a&gt;.&lt;/p&gt;
</content:encoded><category>release</category><category>rulii-bom</category></item><item><title>rulii 2.2.0 and rulii-spring 2.2.0</title><link>https://rulii.org/blog/rulii-2-2-0/</link><guid isPermaLink="true">https://rulii.org/blog/rulii-2-2-0/</guid><description>Forked contexts for async work, local bindings, formal result types, Jakarta EL as a scripting language, eleven more validators, and a Spring integration that makes rulii the application&apos;s Bean Validation provider.</description><pubDate>Sun, 01 Nov 2026 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;rulii 2.2.0 and rulii-spring 2.2.0 are on &lt;a href=&quot;https://central.sonatype.com/namespace/org.rulii&quot;&gt;Maven Central&lt;/a&gt;, alongside the first release of &lt;a href=&quot;https://rulii.org/blog/rulii-bean-validation-1-0-0/&quot;&gt;rulii-bean-validation&lt;/a&gt;. This post covers what changed in the core engine and the Spring integration. The full lists are in the &lt;a href=&quot;https://github.com/algox/rulii/blob/develop/change-log.md&quot;&gt;rulii changelog&lt;/a&gt; and the &lt;a href=&quot;https://github.com/algox/rulii-spring/blob/develop/change-log.md&quot;&gt;rulii-spring changelog&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;forked-contexts-for-async-work&quot;&gt;Forked contexts for async work&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;A &lt;code dir=&quot;auto&quot;&gt;RuleContext&lt;/code&gt; and its scoped bindings were never thread-safe: execution pushes and pops scopes, and two threads on one scope stack discard each other’s work. 2.2.0 adds &lt;code dir=&quot;auto&quot;&gt;ScopedBindings.fork()&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;RuleContext.fork()&lt;/code&gt;. A fork shares every scope the caller has at the moment of the call, by reference, so a value set on those bindings by either side is seen by both. Everything structural stays private: the bindings and scopes the fork adds are never seen by the caller, and scopes the caller pushes or pops afterwards do not affect the fork.&lt;/p&gt;
&lt;p&gt;Async &lt;code dir=&quot;auto&quot;&gt;RuleFlow&lt;/code&gt; steps now run on a fork by default. &lt;code dir=&quot;auto&quot;&gt;AsyncContextMode.INHERITED&lt;/code&gt; is the new default, and the racy &lt;code dir=&quot;auto&quot;&gt;SHARED&lt;/code&gt; mode is gone. A rule set or nested flow, each of which pushes scopes of its own, is now safe to launch asynchronously, several at once. &lt;code dir=&quot;auto&quot;&gt;RuleSet.runAsync&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;RuleFlow.runAsync&lt;/code&gt; fork the given context before submitting work too. See &lt;a href=&quot;https://rulii.org/advanced/async-execution/&quot;&gt;Async Execution&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;local-bindings&quot;&gt;Local bindings&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;A method of a &lt;code dir=&quot;auto&quot;&gt;@Rule&lt;/code&gt; class that declares a &lt;code dir=&quot;auto&quot;&gt;LocalBindings&lt;/code&gt; parameter receives a fresh instance for each run, shared by the pre-condition, condition and actions of that run and invisible to the caller. It is the place for something the condition computes that the actions need, without leaking it into the caller’s bindings. Recursive and concurrent runs never share one. See &lt;a href=&quot;https://rulii.org/core/annotation-rules/&quot;&gt;Building Rules (Declarative)&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;formal-result-types&quot;&gt;Formal result types&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;A rule set’s and a flow’s definition now carry a result type with its origin. State it with &lt;code dir=&quot;auto&quot;&gt;resultType(Type)&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;resultExtractor(Class, Function)&lt;/code&gt; or &lt;code dir=&quot;auto&quot;&gt;returning(Class, Function)&lt;/code&gt;, or let rulii derive it from a typed lambda. A rule set without an extractor reports &lt;code dir=&quot;auto&quot;&gt;RuleSetExecutionStatus&lt;/code&gt;; a script or generic lambda reports unknown rather than &lt;code dir=&quot;auto&quot;&gt;Object&lt;/code&gt;. A stated type that the extractor cannot produce fails at &lt;code dir=&quot;auto&quot;&gt;build()&lt;/code&gt;, so the mismatch is found once, not on every run. &lt;code dir=&quot;auto&quot;&gt;getResolvedResultType()&lt;/code&gt; says where the type came from: &lt;code dir=&quot;auto&quot;&gt;DECLARED&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;DERIVED&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;DEFAULT&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;UNKNOWN&lt;/code&gt; or &lt;code dir=&quot;auto&quot;&gt;NONE&lt;/code&gt;. See &lt;a href=&quot;https://rulii.org/core/rulesets/&quot;&gt;RuleSets&lt;/a&gt; and &lt;a href=&quot;https://rulii.org/core/ruleflow/&quot;&gt;RuleFlows&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;jakarta-expression-language-and-a-default-language&quot;&gt;Jakarta Expression Language, and a default language&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Jakarta EL is now a scripting language, registered as &lt;code dir=&quot;auto&quot;&gt;jakarta-el&lt;/code&gt; with the alias &lt;code dir=&quot;auto&quot;&gt;jel&lt;/code&gt;, available when an EL implementation such as Expressly is on the classpath. Bindings are reachable through &lt;code dir=&quot;auto&quot;&gt;ctx&lt;/code&gt; or as bare identifiers: &lt;code dir=&quot;auto&quot;&gt;#{age &gt;= 18}&lt;/code&gt;. The plain name &lt;code dir=&quot;auto&quot;&gt;el&lt;/code&gt; stays what rulii-spring registers under it, Spring Expression Language, so existing XML rules keep their meaning.&lt;/p&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;ScriptProcessorManager.setDefaultLanguage(name)&lt;/code&gt;, or the system property &lt;code dir=&quot;auto&quot;&gt;rulii.script.defaultLanguage&lt;/code&gt;, declares the language a script is compiled in when none is named. It is never inferred from the classpath. &lt;code dir=&quot;auto&quot;&gt;getAvailableLanguages()&lt;/code&gt; lists what can be compiled right now. See &lt;a href=&quot;https://rulii.org/advanced/scripting/&quot;&gt;Scripting Support&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;eleven-more-validators&quot;&gt;Eleven more validators&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;uuid&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;isbn&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;ean&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;luhnCheck&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;mod10Check&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;mod11Check&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;uniqueElements&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;normalized&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;codePointLength&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;durationMin&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;durationMax&lt;/code&gt; join the &lt;code dir=&quot;auto&quot;&gt;Validators&lt;/code&gt; factory, bringing the built-in set to 48. &lt;code dir=&quot;auto&quot;&gt;url&lt;/code&gt; gains &lt;code dir=&quot;auto&quot;&gt;protocol&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;host&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;port&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;regexp&lt;/code&gt; options; &lt;code dir=&quot;auto&quot;&gt;email&lt;/code&gt; gains &lt;code dir=&quot;auto&quot;&gt;anyDomain()&lt;/code&gt; and a &lt;code dir=&quot;auto&quot;&gt;pattern&lt;/code&gt;; the temporal rules accept the &lt;code dir=&quot;auto&quot;&gt;java.time.chrono&lt;/code&gt; calendars. Every value rule can now &lt;code dir=&quot;auto&quot;&gt;describe()&lt;/code&gt; itself, which is where sentences such as &lt;code dir=&quot;auto&quot;&gt;code size must be between 3 and 20&lt;/code&gt; come from, and takes extra violation parameters for message templates. See &lt;a href=&quot;https://rulii.org/validation/validation-rules/&quot;&gt;Built-in Validation Rules&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;registry-violations-and-performance&quot;&gt;Registry, violations and performance&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;RuleRegistry.getByCategory(&quot;Pricing&quot;)&lt;/code&gt; lists a category and everything below it; &lt;code dir=&quot;auto&quot;&gt;getByTags(&quot;vip&quot;)&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;getCategories()&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;getTags()&lt;/code&gt; complete the set. &lt;code dir=&quot;auto&quot;&gt;RuleViolation.getParameterValues()&lt;/code&gt; keeps the raw values, so the validated value comes back as an object rather than its string. Bindings and contexts are cheaper: ids and scope names no longer draw a random UUID each, the binding name is validated once, and the validation rules find their context by name before type.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;rulii-spring-220&quot;&gt;rulii-spring 2.2.0&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The Spring integration now brings rulii-bean-validation in and makes it the application’s &lt;code dir=&quot;auto&quot;&gt;Validator&lt;/code&gt;. With Spring Boot’s validation module on the classpath, &lt;code dir=&quot;auto&quot;&gt;BeanValidationConfig&lt;/code&gt; defines the &lt;code dir=&quot;auto&quot;&gt;defaultValidator&lt;/code&gt; bean before Boot’s own validation auto-configuration would, pinned to the rulii provider whatever the classpath order, and wired to the Spring &lt;code dir=&quot;auto&quot;&gt;RuleRegistry&lt;/code&gt;, so a &lt;code dir=&quot;auto&quot;&gt;@Validate(&quot;orderRules&quot;)&lt;/code&gt; name is a bean name. Boot’s method validation and &lt;code dir=&quot;auto&quot;&gt;ValidationConfigurationCustomizer&lt;/code&gt; beans work unchanged.&lt;/p&gt;
&lt;p&gt;An application upgrading from 2.1 that validated with Hibernate Validator validates with rulii afterwards, with nothing else changed. &lt;code dir=&quot;auto&quot;&gt;rulii.validation.enabled=false&lt;/code&gt; keeps Hibernate Validator, deterministically, while both are on the classpath. rulii-bean-validation is not a certified implementation, and what differs is listed on the &lt;a href=&quot;https://rulii.org/bean-validation/spec-coverage/&quot;&gt;specification coverage&lt;/a&gt; page. &lt;code dir=&quot;auto&quot;&gt;rulii.script.defaultLanguage&lt;/code&gt; can now be set in &lt;code dir=&quot;auto&quot;&gt;application.properties&lt;/code&gt;, and &lt;code dir=&quot;auto&quot;&gt;result-type&lt;/code&gt; on &lt;code dir=&quot;auto&quot;&gt;&amp;#x3C;r:ruleset&gt;&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;&amp;#x3C;r:ruleflow&gt;&lt;/code&gt; states the result type a script extractor cannot declare. See &lt;a href=&quot;https://rulii.org/bean-validation/spring/&quot;&gt;Bean Validation in Spring Boot&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;breaking-changes&quot;&gt;Breaking changes&lt;/h2&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code dir=&quot;auto&quot;&gt;AsyncContextMode.SHARED&lt;/code&gt; is removed; &lt;code dir=&quot;auto&quot;&gt;INHERITED&lt;/code&gt; is the default and covers it.&lt;/li&gt;
&lt;li&gt;A rule set without a result extractor reports &lt;code dir=&quot;auto&quot;&gt;RuleSetExecutionStatus&lt;/code&gt; as its result type, where it used to report &lt;code dir=&quot;auto&quot;&gt;Object&lt;/code&gt;; a script or generic-lambda extractor reports null.&lt;/li&gt;
&lt;li&gt;Context ids and scope names are no longer UUIDs.&lt;/li&gt;
&lt;/ul&gt;
</content:encoded><category>release</category><category>rulii</category><category>rulii-spring</category></item><item><title>rulii-bean-validation 1.0.0</title><link>https://rulii.org/blog/rulii-bean-validation-1-0-0/</link><guid isPermaLink="true">https://rulii.org/blog/rulii-bean-validation-1-0-0/</guid><description>The first release: a Jakarta Bean Validation 3.1 provider that runs every constraint as a rulii rule, with @Validate, @Expr and @Bind for what annotations cannot say.</description><pubDate>Sun, 01 Nov 2026 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;rulii-bean-validation 1.0.0 is the first release of a new library, on rulii 2.2.0, the &lt;code dir=&quot;auto&quot;&gt;jakarta.validation&lt;/code&gt; API 3.1 and Java 17. It reads the &lt;code dir=&quot;auto&quot;&gt;jakarta.validation&lt;/code&gt; constraints on your beans and turns each one into a rulii rule: named, described, categorised under the bean class and tagged with its groups, visible in the trace and listable from the registry. To the rest of your code it is a Bean Validation provider: &lt;code dir=&quot;auto&quot;&gt;BeanValidator&lt;/code&gt; implements &lt;code dir=&quot;auto&quot;&gt;jakarta.validation.Validator&lt;/code&gt;, a validation returns &lt;code dir=&quot;auto&quot;&gt;Set&amp;#x3C;ConstraintViolation&amp;#x3C;T&gt;&gt;&lt;/code&gt;, and the standard bootstrap finds the provider through &lt;code dir=&quot;auto&quot;&gt;META-INF/services&lt;/code&gt;. A bean annotated for Hibernate Validator validates unchanged, with the same null semantics, paths and messages.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;why-run-validation-on-a-rule-engine&quot;&gt;Why run validation on a rule engine&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Bean Validation stops at the annotation. A constraint checks one value; anything that looks at two fields, at the state of the system, or at who is asking means a &lt;code dir=&quot;auto&quot;&gt;ConstraintValidator&lt;/code&gt; class, a class-level annotation, and a place for logic the specification does not give you. This library keeps everything the annotations do and adds three things:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code dir=&quot;auto&quot;&gt;@Validate&lt;/code&gt;&lt;/strong&gt; attaches a rule, rule set or rule flow from a rulii &lt;code dir=&quot;auto&quot;&gt;RuleRegistry&lt;/code&gt; to a class, property, method or constructor, by name. What runs under that name can change at runtime without touching the bean.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code dir=&quot;auto&quot;&gt;@Expr&lt;/code&gt;&lt;/strong&gt; is an inline cross-field condition in any scripting language rulii knows: &lt;code dir=&quot;auto&quot;&gt;@Expr(value = &quot;#{end.isAfter(start)}&quot;, errorCode = &quot;trip.end&quot;)&lt;/code&gt;. The language comes from the annotation, from &lt;code dir=&quot;auto&quot;&gt;@ExprDefaults&lt;/code&gt; on the class or package, or from &lt;code dir=&quot;auto&quot;&gt;rulii.script.defaultLanguage&lt;/code&gt;; it is never guessed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code dir=&quot;auto&quot;&gt;@Bind&lt;/code&gt;&lt;/strong&gt; parameterises one registered rule per declaration site, the way &lt;code dir=&quot;auto&quot;&gt;max = 10&lt;/code&gt; parameterises &lt;code dir=&quot;auto&quot;&gt;@Size&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The line the library draws: annotations describe what is intrinsic to the data; rules decide what is contextual. The test for an &lt;code dir=&quot;auto&quot;&gt;@Expr&lt;/code&gt; is whether the condition would ever change for a business reason. If yes, it is a rule.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-is-in-the-box&quot;&gt;What is in the box&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;All 22 built-in Jakarta constraints, groups and sequences, &lt;code dir=&quot;auto&quot;&gt;@ConvertGroup&lt;/code&gt;, cascading, container element constraints with value extractors, method and constructor validation, the metadata API and the default message interpolation. The constraints Hibernate Validator users know are there too, under &lt;code dir=&quot;auto&quot;&gt;org.rulii.validation.beans.constraints&lt;/code&gt; with the same names and attributes: &lt;code dir=&quot;auto&quot;&gt;@UUID&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@ISBN&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@EAN&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@CreditCardNumber&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@LuhnCheck&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@Mod10Check&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@Mod11Check&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@UniqueElements&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@Normalized&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@CodePointLength&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@Length&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@Range&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@URL&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;@DurationMin&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;@DurationMax&lt;/code&gt;, each backed by a rulii validator added in 2.2.0.&lt;/p&gt;
&lt;p&gt;The library is not a certified implementation and does not run the TCK. The &lt;a href=&quot;https://rulii.org/bean-validation/spec-coverage/&quot;&gt;specification coverage&lt;/a&gt; page lists every known deviation, chapter by chapter, and the &lt;a href=&quot;https://rulii.org/bean-validation/migration/&quot;&gt;migration guide&lt;/a&gt; says what a project coming from Hibernate Validator will notice.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;spring-boot&quot;&gt;Spring Boot&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;https://rulii.org/blog/rulii-2-2-0/&quot;&gt;rulii-spring 2.2.0&lt;/a&gt; brings this library in and makes it the application’s &lt;code dir=&quot;auto&quot;&gt;Validator&lt;/code&gt;, wired into the Spring rulii context: &lt;code dir=&quot;auto&quot;&gt;@Validate&lt;/code&gt; names are bean names, constraint validators are Spring beans, and the provider is selected even with Hibernate Validator still on the classpath. The &lt;a href=&quot;https://rulii.org/blog/rulii-explorer-1-1-0/&quot;&gt;explorer 1.1.0&lt;/a&gt; shows the validated beans and the rules behind every constraint.&lt;/p&gt;
&lt;p&gt;Start with &lt;a href=&quot;https://rulii.org/bean-validation/validating-beans/&quot;&gt;Validating Beans&lt;/a&gt;.&lt;/p&gt;
</content:encoded><category>release</category><category>rulii-bean-validation</category></item><item><title>rulii-explorer 1.1.0</title><link>https://rulii.org/blog/rulii-explorer-1-1-0/</link><guid isPermaLink="true">https://rulii.org/blog/rulii-explorer-1-1-0/</guid><description>A Beans section for the classes validated with rulii-bean-validation, result types on rule sets and flows, and a resizable sidebar.</description><pubDate>Sun, 01 Nov 2026 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;rulii-explorer 1.1.0 is on Maven Central as &lt;code dir=&quot;auto&quot;&gt;org.rulii:rulii-explorer-spring-boot-starter&lt;/code&gt;. It requires rulii 2.2.0 and rulii-spring 2.2.0, and the new Beans section needs rulii-bean-validation 1.0.0. You can see the explorer running on this site’s &lt;a href=&quot;https://rulii.org/demo/index.html&quot;&gt;demo&lt;/a&gt;, which reads the demo application’s saved descriptor. The full list is in the &lt;a href=&quot;https://github.com/algox/rulii-explorer/blob/develop/CHANGELOG.md&quot;&gt;changelog&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;beans&quot;&gt;Beans&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;An application that validates with &lt;a href=&quot;https://rulii.org/bean-validation/introduction/&quot;&gt;rulii-bean-validation&lt;/a&gt; can now show those classes too. Set &lt;code dir=&quot;auto&quot;&gt;rulii.explorer.beans.enabled=true&lt;/code&gt; and a Rules / Beans switch appears in the top bar. The Beans section lists every validated class member by member: its constraints, &lt;code dir=&quot;auto&quot;&gt;@Expr&lt;/code&gt; expressions, &lt;code dir=&quot;auto&quot;&gt;@Validate&lt;/code&gt; rules, &lt;code dir=&quot;auto&quot;&gt;@Bind&lt;/code&gt; names, container elements and cascades. Every constraint opens the rule the library built for it, read the way a rule page reads: what it checks, the error code, the message and the settings. A graph draws which beans cascade into which and which registry rules they run, and the problem checks gain three codes: &lt;code dir=&quot;auto&quot;&gt;BEAN_NOT_MATERIALIZED&lt;/code&gt;, an &lt;code dir=&quot;auto&quot;&gt;UNRESOLVED_TARGET&lt;/code&gt; for a &lt;code dir=&quot;auto&quot;&gt;@Validate&lt;/code&gt; name nothing is registered under, and &lt;code dir=&quot;auto&quot;&gt;UNDESCRIBABLE&lt;/code&gt; for a configured class that declares nothing.&lt;/p&gt;
&lt;p&gt;Beans are found by a byte-code scan of the auto-configuration packages, from &lt;code dir=&quot;auto&quot;&gt;rulii.explorer.beans.classes&lt;/code&gt;, and from what the validator has validated. The scan reads class files, not classes, so nothing is loaded that is not a bean. The Rules section is exactly what it was without them, down to its counts and its problems.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;result-types&quot;&gt;Result types&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;rulii 2.2.0 records a formal result type on rule sets and flows, and the explorer shows it: what a rule set or flow returns and where the type came from, declared, derived, by default or unknown, on its page, in the hover card and in the graph panel. A flow step that keeps a result under a name shows the result’s type, and the flow page header now lists the flow’s inputs with their types, so the flowchart view no longer shows parameter names only. The descriptor gains &lt;code dir=&quot;auto&quot;&gt;resultType&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;resultTypeOrigin&lt;/code&gt; on rule sets and &lt;code dir=&quot;auto&quot;&gt;resultTypeOrigin&lt;/code&gt; on flows; a flow’s &lt;code dir=&quot;auto&quot;&gt;resultType&lt;/code&gt; is absent when the type is not known, where 1.0 wrote &lt;code dir=&quot;auto&quot;&gt;java.lang.Object&lt;/code&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;resizable-sidebar&quot;&gt;Resizable sidebar&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Drag the sidebar’s right edge to make it wider when a deep category tree needs the room. The width is remembered in the browser, and the arrow keys work on the edge too.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-descriptor&quot;&gt;The descriptor&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The descriptor is version 1.1 with the same schema; a reader of 1.0 can ignore the &lt;code dir=&quot;auto&quot;&gt;beans&lt;/code&gt; array. It can still be written at build time from any &lt;code dir=&quot;auto&quot;&gt;@SpringBootTest&lt;/code&gt; with &lt;code dir=&quot;auto&quot;&gt;RuliiDescriptors.write&lt;/code&gt; and compared between releases, so a review now sees changed constraints as well as changed rules.&lt;/p&gt;
</content:encoded><category>release</category><category>rulii-explorer</category></item></channel></rss>