How to create RESTful web service in Spring

Spring provides many facilities to Java developers which ease the programming as well as reducing the complexity of the code.

One of the most powerful features Spring supports is called invasion of control or dependency inject. In addition to that, throughout the years Spring framework has had tremendous growth and nowadays, different  projects for different platforms are offered range from Android to web services. You can see the list of Spring project from this link.

http://spring.io/projects

If you have decided to code your web service via Spring, you have different options. Here, I have summed up two only.

  • Spring Boot
  • Spring web service

Spring Boot is used to create general Java application with rapid development process whereas, according to documentation Spring web service is useful for SOAP web services. Hence, if you want to create SOAP web services, I recommend to go with Spring Web service and for RESTful and/or rapid development go for Spring Boot.

Spring itself has many great tutorial which you even can use as baseline of your project. This is especially useful that you don’t need to go through all the configuration pains particularly XML files.

In this post, I am just reference you  to useful links that you can use to learn, because they are complete set and explained in details.

To get started with Spring RESTful in Boot you can refer to this tutorial.

https://spring.io/guides/gs/rest-service/

For knowing how to consume a webservice in Spring Boot you can refer to here,

[RESTful] https://spring.io/guides/gs/consuming-rest/

[SOAP] https://spring.io/guides/gs/consuming-web-service/

And lastly but most importantly, in order to know how to deploy Spring Boot web service in Heroku, I highly and utterly recommend you to take a look at this awesome and great tutorial.

http://nicholaspaulsmith.com/spring-boot-on-heroku/

Leave a Reply