I am studying for the Spring Core certification and I have some doubts related this question:
What is the @Controller annotation used for? How can you create a controller without an annotation?
So I know that the @Controller annotation indicates that a particular class serves the role of a controller. The @Controller annotation acts as a stereotype for the annotated class, indicating its role. The dispatcher scans such annotated classes for mapped methods and detects @RequestMapping annotations.
So a controller class is something like this:
@Controller
public class AccountController {
@RequestMapping("/listAccounts")
public String list(Model model) {...}
}
}
Ok, this is pretty clear for me but what exactly means create a controller without an annotation? How can I do it? By XML configuration or how?
Tnx