Why we need @Controller in java webservice?

0 votes
39 views
asked May 10 in JAVA by admin (8,115 points)
Hi

   I am very new java can one give sample code for @Controller and Why we need @Controller in java webservice?

1 Answer

0 votes
answered May 11 by admin (8,115 points)

Hi

  • @Controller is used to mark classes as Spring MVC Controller.
@Controller
public class restClassName{

  @RequestMapping(value={"/URL"})
  @ResponseBody
  public ObjectResponse restFunctionName(){
      return instance
   }
}
...