forked from springframeworkguru/spring5-jokes-app-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated with Joke Service Implementation. Closes springframeworkguru#58
- Loading branch information
1 parent
5d2e4c2
commit ff43929
Showing
3 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/java/com/springframework/spring5jokesappv2/services/JokeService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.springframework.spring5jokesappv2.services; | ||
|
||
public interface JokeService { | ||
|
||
String getJoke(); | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/springframework/spring5jokesappv2/services/JokeServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |