1438886
1438886

Reputation: 61

spring web controller use as web service

Currently I use Spring mvc to develop my we application. In future there will be a requirement to develop mobile app for this application.

In asp.net c# MVC have ability to use there web controller class as the web service. Then mobile app can use that controller class as web service.

I want to know is there an ability to use Spring MVC controllers as a we service. If yes, then how. Please explain.

Upvotes: 1

Views: 778

Answers (1)

Alex Barnes
Alex Barnes

Reputation: 7218

You can easily write a Restful webservice using Spring MVC. The controller classes can return XML/JSON as required. It is simply a case of configuring an appropriate ViewResolver in this case a ContentNegotiationViewResolver.

This is an excellent guide which will walk you through the basics of Spring MVC as a webservice.

Upvotes: 2

Related Questions