Posts

Showing posts with the label dispatcher servlet

Hello World Service, Dispatcher Servlet and Auto Configuration

Image
In Previous topic we have installed eclipse and created on rest-webservice also we have seen our service was started with default port 8080 on default tomcat server. Let's create one Hello World service and we will simple return hello world as a string as well we will return a POJO from our service. For this let's crate one controller class as  HelloWorldController.class, first we need to tell spring that this class is controller class as we are working on rest application we can use @RestController annotation on this class. RestController is used for  making restful web services  with the help of the @RestController annotation. This annotation is used at the class level and allows the class to handle the requests made by the client or user. Let's create one method in controller class which will return String once created then we need to specify the mapping type of this method like whether it is a get request or post or any other. Here we are only returning a String so we c