Skip to content
Leader docs0.4

Spring Boot integration

Latest stable Based on Leader release 0.4.0

Auto-configure electors and guard invocations with AspectJ compile-time weaving.

Release 0.4.0 uses Freefair post-compile AspectJ weaving. Do not add @EnableAspectJAutoProxy, and Kotlin methods do not need to be open. Private methods are not intercepted; startup validation reports invalid declarations. Verify the woven application artifact, not only a plain unit test.

@LeaderElection supports nullable synchronous and suspend results plus Mono, Flux, and Flow. Long streams require autoExtend=true, or streamBounded=true only when completion is guaranteed inside the lease. @LeaderGroupElection supports synchronous, suspend, and Mono, but rejects Flux and Flow because per-slot stream extension is undefined.

Use valid SpEL such as "'prefix-' + #param". Invalid expressions and impossible group settings fail validation. Auto-configuration orders elector creation, AOP factories, Micrometer, then aspects so instrumentation sees the same execution boundary.