background preloader

Software Development

Facebook Twitter

Microsoft. SharePoint 2013. Java. SpringSource. Spring MVC hello world annotation example. In this tutorial, we show you how to create a Spring @MVC annotation-based hello world example. Technologies used : Spring 2.5.6JDK 1.6Maven 3Eclipse 3.6 P.S This annotation-based example is converted from last Spring MVC hello world XML-based example. 1. Spring Dependency Spring @MVC is bundled in the same spring-webmvc.jar. <! 2. Now, you can use @Controller and @RequestMapping to replace the XML configuration. Controller – The controller class is no longer need to extends base controller like AbstractController or SimpleFormController, just simply annotate the class with a @Controller annotation.Handler Mapping – No more declaration for the handler mapping like BeanNameUrlHandlerMapping, ControllerClassNameHandlerMapping or SimpleUrlHandlerMapping, all are replaced with a standard @RequestMapping annotation.

File : HelloWorldController.java In this case, if an URI pattern “/welcome” is requested, it will map to this HelloWorldController, and handle the request with helloWorld() method. 3. 4.

Dev Ops