Corda Inject
The CordaInject annotation should be used within Flows to inject Corda's platform services.
The annotation is placed onto a Flow's fields/properties and not on constructor parameters.
Example usage:
- Kotlin:
class MyFlow : ClientStartableFlow { lateinit var flowEngine: FlowEngine lateinit var flowMessaging: FlowMessaging override fun call(requestBody: RestRequestBody): String { ... } }Content copied to clipboard - Java:
class MyFlow implements ClientStartableFlow { public FlowEngine flowEngine; public FlowMessaging flowMessaging; public String call(RestRequestBody requestBody) { ... } }Content copied to clipboard
The injected properties cannot be accessed within a Flow's constructor and should only be used from within a Flow's call method or subsequently executed code.