Fortune teller worker application

We will now build a Spring Boot application that will run every five seconds and output a random fortune. Let's call this application fortune-teller.

This application is a Spring Boot (https://spring.io/guides/gs/spring-boot/) application. You can use the IDE of your choice for this exercise.

We will begin by creating a class called FortuneCookieGenerator.java. This class will be responsible for generating random fortunes using the words list. The length of the fortune will be limited by the fortuneLength attribute. The contents of the FortuneCookieGenerator.java are as follows:

package cf.developers;import java.util.Random;import org.springframework.beans.factory.annotation.Value;import org.springframework.stereotype.Component; ...

Get Cloud Foundry for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.