Posts

Showing posts with the label SpringREST

JAX-RS vs Spring REST - Differences

In this article, I will be covering the differences between JAX-RS/Jersey and Spring REST. What is REST? REST stands for Representational State Transfer.  It is an architectural style that can be used for web services. A REST server exposes functionality as REST endpoints which are simply URLs. A REST client simply uses the services exposed by the REST server by accessing the corresponding URL. Edit What is JAX-RS JAX-RS stands for Java API for RESTful Web Services (JAX-RS). It is the standard Java API for developing RESTful web services. The latest version of JAX-RS is JAX-RS 2.0.  It is part of Java EE 7, so it does not need to be included separately. It is just a specification, it does not provide an implementation. Jersey is the reference implementation of JAX-RS specification. There are other implementations of JAX-RS like RESTEasy, etc   What is Spring REST The Spring framework also provides REST support. The Spring MVC module can be used to develop a REST service....

Spring REST client using RestTemplate in Eclipse and Maven

Image
In this article, I will be demonstrating how you can create a Spring REST client using RestTemplate. In order to see how you can create a simple Spring REST service, you can refer to this blog post. What is Spring RESTTemplate? Spring provides a class called RestTemplate . This is the starting point in creating a REST client application.  It uses the URI and the HTTP method to invoke in order to connect to a REST service. It has several methods that allow you to invoke the HTTP methods on the specified URI Edit Project Creation Step 1 – Create a Maven Project in Eclipse . You can refer to this blog post. You will get a project as follows:   Step 2 – Add dependencies to POM file. Add the following to your pom.xml file: <properties> <spring.framework>5.1.3.RELEASE</spring.framework> <spring.web>5.1.3.RELEASE</spring.web> </properties> <dependencies> <dependency> <groupId>org.springframewo...

Creating a Spring REST application in Maven and Eclipse

Image
In this article, I will be demonstrating how to create a REST application via Spring using Maven and Eclipse. Create a Project and And Maven Support Step 1 – Follow the steps in this article to create a web project in Eclipse with Maven Support. You should see a project as follows: Edit Step 2 – Add the Maven Dependencies for Spring to the pom file as follows: <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>5.1.3.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>5.1.3.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>5.1.3.RELEASE</version> ...