Class InitialStateAutoConfiguration
java.lang.Object
io.github.jspinak.brobot.startup.state.InitialStateAutoConfiguration
Auto-configuration for initial state management in Brobot applications.
This configuration automatically handles states marked with @State(initial = true) by creating the necessary startup configuration and activating initial states when the application is ready.
Key features:
- Automatic BrobotStartupConfiguration creation from annotations
- ApplicationReadyEvent listener for state activation
- Configurable delay before verification in real mode
- Profile-specific behavior (test vs production)
- Opt-out capability via properties
Configuration properties:
brobot.startup.verify: true # Enable verification brobot.startup.auto-activate: true # Auto-activate initial states brobot.startup.initial-delay: 5 # Seconds to wait before verification brobot.startup.delay: 1 # Additional delay for startup brobot.startup.fallback-search: false # Search all states if initial not found brobot.startup.activate-first-only: true # Only activate first found state
- Since:
- 1.1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Test profile specific configuration that optimizes initial state handling for tests. -
Constructor Summary
ConstructorsConstructorDescriptionInitialStateAutoConfiguration
(InitialStates initialStates, StateMemory stateMemory, BrobotProperties brobotProperties) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Automatically activates initial states when the application is ready.Creates BrobotStartupConfiguration automatically from states marked with @State(initial = true).
-
Constructor Details
-
InitialStateAutoConfiguration
public InitialStateAutoConfiguration(InitialStates initialStates, StateMemory stateMemory, BrobotProperties brobotProperties)
-
-
Method Details
-
brobotStartupConfiguration
Creates BrobotStartupConfiguration automatically from states marked with @State(initial = true). Applications can override this by providing their own BrobotStartupConfiguration bean.- Returns:
- Configured BrobotStartupConfiguration
-
autoActivateInitialStates
@EventListener(org.springframework.boot.context.event.ApplicationReadyEvent.class) @ConditionalOnProperty(value="brobot.startup.auto-activate", havingValue="true", matchIfMissing=true) public void autoActivateInitialStates(ApplicationReadyEvent event) Automatically activates initial states when the application is ready. This listener is triggered after all beans are initialized and the application is fully started.The activation includes a configurable delay for real mode to allow the GUI to stabilize before attempting to find states on the screen.
- Parameters:
event
- ApplicationReadyEvent indicating the application is ready
-