I've successfully edited and deployed Spring's sample application, Petclinic. Petclinic-servlet.xml
uses the beans/spring classes listed below:
My question is how do you know which beans/classes your servlet needs? For example, I'm creating a Spring servlet from scratch - How would I know that Spring needs, for example, the ContentNegotiatingViewResolver configured? What document should I read that would lists all the Spring beans that must be implemented if you want feature x in your servlet?
In Spring we do not use Servlets(At least as terminology usage). Spring gives us something called Controller. A Controller = Servlet + Some additional functionalities as jasper report etc. So as you use Controller class you are very much using Servlets. Spring has not deviated itself away from the java Servlet technology. In fact it has used the existing servlet technology and added some more functionalities to it and named it as Controllers. Visit the Controller API and go through the derived subclasses mainly the BaseCommandController and its subclasses and look for examples of these classes on google. For your information we configure Controllers as below
1. Create a Class
2.Make this class as a subclass of one of these controllers(Using extends keyword)
3. Your class inherits some methods from their super classes(Spring Controller classes)
4. Use these methods to code your logic and display the page.
In current versions of Spring, you don't implement or extend any of Spring's Controller classes or interfaces for your Controllers. The Controller of your will be pojos. You will put Annotations in the class to get the mapping and all the rest.