Skip to content

Commit

Permalink
Merge pull request #3 from Sofimedina/assignment-reviewed
Browse files Browse the repository at this point in the history
assigmente reviewed fixes
  • Loading branch information
Sofimedina authored Feb 7, 2023
2 parents 27620be + 3d1b436 commit 49bfee0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class SfgDiApplication {
public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(SfgDiApplication.class, args);

PetController petController =(PetController) ctx.getBean("petController");
PetController petController = ctx.getBean("petController", PetController.class);
System.out.println("--- The Best Pet is ---");
System.out.println(petController.whichPetIsTheBest());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public PetController(PetService petService) {
this.petService = petService;
}


public String whichPetIsTheBest(){
return petService.getPetType();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
/**
* Created by jt on 12/28/19.
*/
@Service
@Profile("cat")
@Service("petService")
public class CatPetService implements PetService {
@Override
public String getPetType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
* Created by jt on 12/28/19.
*/
@Profile({"dog", "default"})
@Service("petService")
public class DogPetService implements PetService{
@Override
@Service
public class DogPetService implements PetService {
public String getPetType(){
return "Dogs are the best!";
}
Expand Down

0 comments on commit 49bfee0

Please sign in to comment.