close

Filter

loading table of contents...

Workflow Manual / Version 2204

Table Of Contents

5.8.1 Using Spring Beans

The Spring context is loaded at startup time and is shut down when the server is shut down. The Spring configuration can refer to the Workflow Server's Unified API connection, using the same name ("connection") as in the CAE. An action or expression may implement the interface com.coremedia.cap.workflow.plugin.CapConnectionAware. If it does so, the connection is injected before the action is executed or the expression is evaluated for the first time.

In order to use a bean in your action or expression proceed as follows:

  1. Use the common Spring ways to add your custom configuration to the workflow server's Spring application context.

  2. Let your customized actions or expressions extend com.coremedia.workflow.common.util.SpringAwareAction or com.coremedia.workflow.common.util.SpringAwareExpression respectively.

  3. Get the bean inside your customized code using the getBean() method, for example use

protected ActionResult execute(Process process) {
InboxFactory inboxes = (InboxFactory) getBean("inboxFactory");
…
}

The configured beans may implement the common Spring ways to receive life cycle events from the workflow server's application context. Additionally, the beans may implement the interface com.coremedia.workflow.common.util.WorkflowServerLifecycleAware, if they want to initiate asynchronous operations. Such operations may start after the method workflowServerStart() is called and must be completed before the method workflowServerStop() returns. Only singleton beans receive these callbacks and only if they implement the given interface.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.