The MarkLogic connector is published to Maven Central and can thus be expressed as a regular dependency of a Java application that also depends on the Spark APIs.
As an example, please see the project configuration in the java-dependency example project for how to depend on the MarkLogic connector as a library. The org.example.App class in the project demonstrates a very simple Spark Java program for accessing the data in the application deployed via the Setup guide.