Description:

SpringContextProcessor – allows integration of processes encapsulated in Spring Application Context to run as NiFi processor by becoming a runtime host for an instance of Spring Application Context.

Communication between NiFi and process encapsulated within Spring Application Context is accomplished via Spring Messaging (one of the core modules of Spring Framework) and supports 3 usage modes:

The example below demonstrates template configuration for bi-directional Spring Application Context configuration:
    <int:channel id=”fromNiFi”/>

    <!—
    your custom app configuration to receive messages from ‘fromNiFi’ channel and optionally send back to NiFi via ‘toNiFi’ channel.
    It could contain any Spring-based application (i.e., Spring Integration, Apache Camel and/or custom code). All you need to do is inject
    channels into your beans and send/receive messages from it.
    -->

    <int:channel id="toNiFi">
        <int:queue/>
    </int:channel>
            

The component is based on assumption that user has an existing Spring Application encapsulated in Spring Context that exposes optional in/out MessagingChannels to allow data to flow to/from ApplicationContext and into/out-of. NiFi. Such application is realized by having a directory on the file system, which contains contains all required resources for such application to run. Such resources usually are JAR files to satisfy application's class-path as well as JAR representing the application and its configuration. Below is the example of what such directory may contain. In this case the 'SI_DEMO-0.0.1-SNAPSHOT.jar' represents the actual application and the rest of the JARs represent class-path dependency required by an application.

        deps
         ├── SI_DEMO-0.0.1-SNAPSHOT.jar
         ├── aopalliance-1.0.jar
         ├── commons-logging-1.2.jar
         ├── spring-aop-4.3.19.RELEASE.jar
         ├── spring-beans-4.3.19.RELEASE.jar
         ├── spring-context-4.3.19.RELEASE.jar
         ├── spring-core-4.3.19.RELEASE.jar
         ├── spring-expression-4.3.19.RELEASE.jar
         ├── spring-integration-core-4.3.17.RELEASE.jar
         ├── spring-messaging-4.3.19.RELEASE.jar
        

You introduce the processor the usual way and then configure its properties: