O'Reilly logo

Cloud Foundry for Developers by David Wu, Rahul Jain, Rick Farmer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required