Spring MVC

Difference between tags annotation-config and component-scan used in web.xml –
  • <context:annotation-config> : It is used to activate applied annotations in already registered beans in application context.
  • <context:component-scan>: It is used to register the beans in context plus it also scans the annotations inside beans and activates them.
Difference between classes ContextLoaderListener & DispatcherServlet used in web.xml –
  • ContextLoaderListener – It creates root application context. However, the beans in the root context cannot access the beans in child contexts (directly).
  • DispatcherServlet – It creates one child application context per servlet entry. In addition, the child contexts can access the beans defined in the root context.
Validation Support in Spring MVC –
  • Using JSR-303 Annotations and any reference implementation e.g. Hibernate Validator
  • Using a custom implementation of org.springframework.validation.Validator interface
Advantages of MVC framework –
  • Supports RESTful URLs.
  • Annotation-based configuration
  • Supports to plug with other MVC frameworks like Structs, Structs2, JSF, etc.
  • Flexible, in other words, supports different View types like JSP, Velocity, XML, PDF, Tiles, etc.