diff --git a/pom.xml b/pom.xml index b3fa5e858..6b9927f7d 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,11 @@ org.springframework.boot spring-boot-starter-web - + + guru.springframework + chuck-norris-for-actuator + 2.4.0 + org.springframework.boot spring-boot-starter-test diff --git a/src/main/java/com/springframework/spring5jokesappv2/services/JokeService.java b/src/main/java/com/springframework/spring5jokesappv2/services/JokeService.java new file mode 100644 index 000000000..f627e8140 --- /dev/null +++ b/src/main/java/com/springframework/spring5jokesappv2/services/JokeService.java @@ -0,0 +1,6 @@ +package com.springframework.spring5jokesappv2.services; + +public interface JokeService { + + String getJoke(); +} diff --git a/src/main/java/com/springframework/spring5jokesappv2/services/JokeServiceImpl.java b/src/main/java/com/springframework/spring5jokesappv2/services/JokeServiceImpl.java new file mode 100644 index 000000000..7b26deb14 --- /dev/null +++ b/src/main/java/com/springframework/spring5jokesappv2/services/JokeServiceImpl.java @@ -0,0 +1,18 @@ +package com.springframework.spring5jokesappv2.services; + +import guru.springframework.norris.chuck.ChuckNorrisQuotes; +import org.springframework.stereotype.Service; + +@Service +public class JokeServiceImpl implements JokeService{ + private final ChuckNorrisQuotes chuckNorrisQuotes; + + public JokeServiceImpl(){ + this.chuckNorrisQuotes = new ChuckNorrisQuotes(); + } + + @Override + public String getJoke() { + return chuckNorrisQuotes.getRandomQuote(); + } +}