JCICS and JCICSX in Spring Boot applications

You can use JCICS or JCICSX in both Spring Boot WAR and Spring Boot JAR applications to call CICS® services.

This is contrary to other integration aspects of Java™ EE and Liberty that are only available when the Spring Boot application is deployed as a WAR. Although you can resolve your Spring Boot dependencies against JCICS or JCICSX by using only the com.ibm.cics.server or com.ibm.cics.jcicsx artifact on Maven Central, a more consistent approach is to use the bill of materials (BOM) file. This ensures you resolve against consistent versions of a range of CICS artifacts as shown in the examples below.

Note: The following instructions use the JCICS library as an example but also apply to JCICSX.

Avoid binding the JCICS library into your application as this is provided by the CICS runtime.

If you are using Maven, you can achieve this by compiling against the JCICS library or by using <scope>provided</scope>. Or, if you are using the CICS TS BOM, the <scope>import</scope> on the <dependency> element automatically defers the scope value to the CICS BOM. The CICS BOM applies the provided scope, which ensures JCICS is only included at build time. It is not embedded in your application where it might potentially conflict with the version that is used by the CICS runtime. For example,
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.ibm.cics</groupId>
            <artifactId>com.ibm.cics.ts.bom</artifactId>
            <version>5.6-20200609123739</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

If you are using Gradle, you can take advantage of the CICS TS BOM by coding a compileOnly directive with the enforcedPlatform qualifier. Doing so infers version information from the BOM and ensures that references to the contained artifacts are consistent and compatible. Thereafter, to declare a dependency on the JCICS library (com.ibm.cics.server) or any other CICS artifact from the BOM, a version qualifier is not required, simply code the appropriate dependency statement.

For example,
dependencies {
    compileOnly enforcedPlatform('com.ibm.cics:com.ibm.cics.ts.bom:5.6-20200609123739')
    compileOnly("com.ibm.cics:com.ibm.cics.server")  //dependency on JCICS
}
Note: See Maven Central for the latest version number for appropriate for your release of CICS.

For more CICS-provided dependencies you can resolve with Maven and Gradle, see Managing Java dependencies using Gradle or Maven.