A Spring Cloud Task is made up of a Spring Boot application that is expected to end. In
our POM above, we created the shell of a Spring Boot application from a dependency
perspective by setting our parent to use the spring-boot-starter-parent
.
Spring Boot provides a number of additional "Starter POMs". Some of which are appropriate
for use within tasks (spring-boot-starter-batch
, spring-boot-starter-jdbc
, etc) and
some may not be ('spring-boot-starter-web` is probably not going to be used in a task).
The indicator of if a starter makes sense or not comes down to if the resulting
application will end (batch based applications typically end, the
spring-boot-starter-web
dependency bootstraps a servlet container which probably wont').
For this example, we’ll only need to add a single additional dependency, the one for Spring Cloud Task itself:
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-task-core</artifactId> <version>1.2.1.RELEASE</version> </dependency>