Skip to content

fix(server): evaluate Hazelcast switches at runtime to support AOT - #5870

Merged
SteKoe merged 1 commit into
masterfrom
fix/hazelcast-selective-caches-aot
Nov 6, 2026
Merged

SteKoe merged 1 commit into
masterfrom
fix/hazelcast-selective-caches-aot

Conversation

@SteKoe

@SteKoe SteKoe commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #5739.

Problem

@ConditionalOnProperty is evaluated at build time when AOT is used. After #5739 it is still used on sentNotificationsMap, notificationFiltersMap and on the class (spring.boot.admin.hazelcast.enabled), so these switches are ignored at runtime when the application was built without them. The event store already decides at runtime, which leads to a mixed state with spring.boot.admin.hazelcast.enabled=false.

Tested on master (ac10137bf) in a 3 node cluster, image built without the properties, started with -Dspring.aot.enabled=true:

Scenario Event store Trigger Expected
sent-notifications-enabled=false Hazelcast HazelcastNotificationTrigger plain NotificationTrigger
hazelcast.enabled=false in-memory HazelcastNotificationTrigger + sent-notifications map in-memory + plain NotificationTrigger

Without AOT both behave correctly.

Changes

  • Remove @ConditionalOnProperty from AdminServerHazelcastAutoConfiguration and decide inside the factory methods (isEnabled, which also checks spring.boot.admin.hazelcast.enabled).
  • sentNotificationsMap returns null when disabled, so AdminServerNotifierAutoConfiguration creates the plain NotificationTrigger (the ObjectProvider yields no map).
  • notificationFiltersMap returns a local ConcurrentHashMap when disabled, so a user defined FilteringNotifier that gets the bean injected keeps working. The declared return type changes from IMap to ConcurrentMap. By default it is still the Hazelcast map.
  • spring.boot.admin.hazelcast.enabled=false now disables all three consistently.
  • Docs: describe what each switch does and that they work with AOT.

Tests

  • AdminServerAutoConfigurationTest: local filters map when disabled, Hazelcast filters map by default, hazelcast.enabled=false disables event store and trigger.
  • AdminServerHazelcastAutoConfigurationTest: guard that the class and its methods have no @ConditionalOnProperty. It checks the annotation only, not AOT behaviour.
  • Verified manually with real AOT (log says Starting AOT-processed), image built without the properties:
Scenario Event store Trigger Maps
default Hazelcast HazelcastNotificationTrigger event-store, sent-notifications
event-store-enabled=false in-memory HazelcastNotificationTrigger sent-notifications
sent-notifications-enabled=false Hazelcast NotificationTrigger event-store
hazelcast.enabled=false in-memory NotificationTrigger none

Release notes

  • spring.boot.admin.hazelcast.sent-notifications-enabled, notification-filters-enabled and enabled are now evaluated at runtime and work with AOT.

@ConditionalOnProperty is evaluated at build time with AOT, so
sent-notifications-enabled, notification-filters-enabled and
hazelcast.enabled were ignored at runtime. Decide inside the factory
methods instead:

- sentNotificationsMap is null when disabled -> plain NotificationTrigger
- notificationFiltersMap is a local map when disabled, so a user defined
  FilteringNotifier keeps working
- hazelcast.enabled disables all three, consistently with the event store

Related to #5739, #4773
@SteKoe
SteKoe requested a review from a team as a code owner November 6, 2026 11:36
@SteKoe
SteKoe enabled auto-merge (squash) November 6, 2026 11:37
@SteKoe
SteKoe merged commit 09c8f10 into master Nov 6, 2026
1 check passed
@SteKoe
SteKoe deleted the fix/hazelcast-selective-caches-aot branch November 6, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant