You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**Custom dependencies**: Any beans or objects you've configured in your target system
178
-
179
-
**Method parameters are automatically injected** by Flamingock based on your target system configuration and global dependencies.
180
-
181
159
**Why rollback is required:**
182
-
-**Non-transactional systems**: Used automatically if execution fails
183
-
-**All systems**: Required for CLI/UI undo operations
184
-
-**Safety**: Ensures every change can be reversed
185
-
-**Governance**: Demonstrates you've thought through the change impact
186
-
187
-
For detailed information about dependency injection and parameter configuration, see [Method Parameters and Dependency Injection](./dependency-injection.md).
188
-
189
-
## Method parameters and dependency injection
190
-
191
-
Changes receive dependencies through method parameters, automatically injected by Flamingock using a **flexible, multi-source approach** with fallback hierarchy.
192
-
193
-
### Change Execution Dependency Resolution
194
-
195
-
Change execution uses a flexible dependency resolution flow(in this priority order):
196
-
197
-
1.**Target system context** - dependencies from **constructor** + `.withXXX()` methods
198
-
2.**Target system additional dependencies** - added via `.addDependency()` or `.setProperty()`
199
-
3.**Global context** (fallback) - shared dependencies available to all target systems
200
-
201
-
202
-
### Key Benefits of This Architecture
203
-
204
-
-**Target system isolation**: Each target system has its own dependency context
205
-
-**Flexible fallback**: Changes can access both system-specific and shared dependencies
206
-
-**Clear precedence**: Target system dependencies always override global ones
207
-
-**Type safety**: Strongly typed dependency injection with compile-time checking
160
+
- Executed automatically on failure for non-transactional systems
161
+
- Required for CLI/UI undo operations
162
+
- Ensures every change can be reversed
208
163
209
-
For complete details on target system configuration vs change execution dependencies, see [Target Systems Introduction](../target-systems/introduction.md#dependency-injection).
164
+
For detailed information about method parameters, dependency injection, and advanced parameter features, see [Apply and rollback methods](./apply-and-rollback-methods.md).
The exact dependencies available depend on your target system and configuration.
40
+
41
+
See [Context and Dependencies](../flamingock-library-config/context-and-dependencies.md) for complete details on configuring and understanding available dependencies.
42
+
43
+
## Method rules
44
+
45
+
-**Must be public** - Flamingock needs to invoke them
46
+
-**Any name works** - `apply`, `execute`, `migrate`, your choice
47
+
-**Return type ignored** - Can be void or return a value
48
+
-**All parameters injected** - No manual parameters
By default, all parameters are required. Missing dependencies throw exceptions.
82
+
83
+
Use `@Nullable` for optional dependencies:
84
+
85
+
```java
86
+
@Apply
87
+
publicvoid apply(
88
+
S3Client s3, // Required
89
+
@NullableCacheService cache // Optional - null if not available
90
+
) {
91
+
if (cache !=null) {
92
+
cache.invalidate();
93
+
}
94
+
// proceed with S3 operation
95
+
}
96
+
```
97
+
98
+
### Lock-guarded dependencies
99
+
100
+
Flamingock uses a background daemon to automatically refresh the distributed lock, ensuring your Changes maintain exclusive access during execution. As an additional safety layer, Flamingock wraps injected dependencies with proxies that verify the lock is still valid before each method call.
101
+
102
+
This proxy mechanism provides extra robustness - ensuring that operations don't even start if the lock is lost for any reason (though this is very unlikely given the background refresh daemon).
103
+
104
+
For non-critical or local components, use `@NonLockGuarded` to skip the proxy:
@NonLockGuardedList<String> localData // Not guarded - no proxy overhead
111
+
) {
112
+
// elastic calls are protected by lock validation
113
+
// localData is used directly without checks
114
+
}
115
+
```
116
+
117
+
See [Lock documentation](../flamingock-library-config/lock.md) for more details on lock protection.
118
+
119
+
### Dependency resolution details
120
+
121
+
When Flamingock looks for a dependency to inject, it follows a specific hierarchy. This ensures system-specific dependencies take precedence over general ones.
122
+
123
+
For complete understanding of dependency resolution, see [Dependency Resolution Hierarchy](../flamingock-library-config/context-and-dependencies.md#dependency-resolution-hierarchy).
0 commit comments