listPerson is called to list the users, so they need the model object containing the users to display in the front end, so model object is used, in case of removePerson, there is no need of model object, so they are not using it.
posted 4 years ago
There is a use of @Qualifier annotation in the controller. When I remove that, I get an error:
No qualifying bean of type [com.journaldev.spring.service.PersonService] is defined: expected single matching bean but found 2: personService,personServiceImpl
Now both personService and personService are interface and corresponding implementing class respectively. Why would it give error on that?
I can understand if there are two beans defined for the same class with different ids, but that is not the case.
You have a @Service annotation on the PersonServiceImpl class. This means that spring will create an instance of PersonServiceImpl. You also have a PersonServiceImpl declared in your spring XML. THis creates another instance of PersonServiceImpl. SO, you have 2 instances of PersonServiceImpl
The two armies met. But instead of battle, they decided to eat some pie and contemplate this tiny ad:
create, convert, edit or print DOC and DOCX in Java