I'm studying Spring MVC, and I'm developing a system that will contain questions and answers. How do I get the Controller, I create one for QuestionsController and one for AnswersController, or only 1 for the two
I'm studying Spring MVC, and I'm developing a system that will contain questions and answers. How do I get the Controller, I create one for QuestionsController and one for AnswersController, or only 1 for the two
On your system, the user will ask a question and you will return the answer on the same request, right?
If it is, you will only have one Controller, it will receive the user request with the question, you will process it in a Service, if you need to save something in the database use the Repository and return the response to the control that it will return the response in the request.
It depends on how you are modeling the system. You could for example have a single entity to manage the issues, so it would address both the answers and the questions.