-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding pet controller, broken example for assignment
- Loading branch information
1 parent
ec3faa3
commit e3d002f
Showing
5 changed files
with
55 additions
and
0 deletions.
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
15 changes: 15 additions & 0 deletions
15
src/main/java/guru/springframework/sfgdi/controllers/PetController.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,15 @@ | ||
package guru.springframework.sfgdi.controllers; | ||
|
||
import guru.springframework.sfgdi.services.PetService; | ||
|
||
/** | ||
* Created by jt on 12/28/19. | ||
*/ | ||
public class PetController { | ||
|
||
private final PetService petService; | ||
|
||
public String whichPetIsTheBest(){ | ||
return petService.getPetType(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/guru/springframework/sfgdi/services/CatPetService.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,14 @@ | ||
package guru.springframework.sfgdi.services; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* Created by jt on 12/28/19. | ||
*/ | ||
@Service("cat") | ||
public class CatPetService implements PetService { | ||
@Override | ||
public String getPetType() { | ||
return "Cats Are the Best!"; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/guru/springframework/sfgdi/services/DogPetService.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,13 @@ | ||
package guru.springframework.sfgdi.services; | ||
|
||
import org.springframework.context.annotation.Profile; | ||
|
||
/** | ||
* Created by jt on 12/28/19. | ||
*/ | ||
@Profile({"dog", "default"}) | ||
public class DogPetService { | ||
public String getPetType(){ | ||
return "Dogs are the best!"; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/guru/springframework/sfgdi/services/PetService.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,9 @@ | ||
package guru.springframework.sfgdi.services; | ||
|
||
/** | ||
* Created by jt on 12/28/19. | ||
*/ | ||
public interface PetService { | ||
|
||
String getPetType(); | ||
} |