Class SideEffectConfigurationEagerTest

java.lang.Object
ubic.gemma.core.context.SideEffectConfigurationEagerTest

public class SideEffectConfigurationEagerTest extends Object
Guards the trap described in LazyInitByDefaultPostProcessor.

A @Configuration that implements InitializingBean normally exists for the side effect in afterPropertiesSet() — registering a Hibernate event listener, priming a registry — and nothing injects it. In CLI contexts LazyInitByDefaultPostProcessor marks every non-infrastructure definition lazy-init, so such a bean is defined but never instantiated and its side effect never happens. Nothing throws; the capability is just absent.

That cost us AclEventListenerConfig and AuditTrailEventListenerConfig between 2026-05-18 and 2026-08-08: no ACLs were created for CLI-loaded experiments, no ACLs were removed for CLI-deleted ones, and no CREATE/DELETE audit events were emitted. The fix in both cases was @Lazy(false), which the post-processor honours (it skips any definition annotated @Lazy, whatever the value).

This test fails if a new such configuration is added without that annotation.

  • Constructor Details

    • SideEffectConfigurationEagerTest

      public SideEffectConfigurationEagerTest()
  • Method Details

    • configurationsWithSideEffectsMustOptOutOfLazyByDefault

      @Test public void configurationsWithSideEffectsMustOptOutOfLazyByDefault()