Easiest Way to Create REST API using Spring Boot

Last Updated : 08 Aug, 2024
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Spring Boot is a powerful framework that makes it easy to create RESTful APIs. In this article, we will go through a step-by-step guide on how to create a RESTful API in Spring Boot with MySQL and JPA. We will start by creating a new Spring Boot project and configuring it for our needs.

For developers eager to deepen their knowledge and expertise in building RESTful APIs using Spring Boot, enrolling in a specialized Java backend development course and RESTful API development could be extremely beneficial. This course covers advanced topics from basic setup to complex integrations with databases like MySQL, utilizing JPA for data handling, and best practices for API security and performance.

Step-by-Step Implementation to Create REST API using Spring Boot

Below are the steps to implement REST API in Spring Boot with MySQL and JPA.

Step 1: Setup Development Environment

Before we begin, we need to set up our development environment. We will need to install the following software:

  • Java Development Kit (JDK)
  • Intellij (or any other preferred IDE like Eclipse)
  • MySQL Server

Step 2: Create a Spring Boot Project

The first step is to create a new Spring Boot project using the Spring Boot Initializer . Open any web browser and go to Spring Initializer.

Project Metadata

Set the following options:

  • Project: Maven Project/Gradle according to your need
  • Language : Java
  • Spring Boot: 3.0.2 (or the latest version)
  • Group : com.example
  • Artifact : spring boot API/any desired info of your own choice
  • Description : Demo Project for Spring Boot API/ any information you like about the project
  • Packaging : Jar
  • Java : 11

Click on the “Add Dependencies” button and add the following dependencies:

  • Spring Web
  • Spring Data JPA
  • MySQL Driver

Select these dependencies and click on the Generate button. Extract the downloaded project ZIP file to your preferred location.

<dependencies>
<!-- Spring Boot Web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<!-- Spring Data JPA -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<!-- MySQL Driver -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>

<!-- Spring Boot Starter Test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

pom.xml File:

XML
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>spring-boot-api</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>spring-boot-api</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.2</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <java.version>11</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

The above XML file contains all the Maven dependencies needed for our application.

Step 3: Create Entity Class

Next, we need to create an entity class to represent our data model. In this example, we will create a “Product” entity class.

  • Right-click on the “com.example” package and create a package called entity inside it.
  • Enter “Product” as the class name in the “entity” package and click on the “Finish” button.
  • In the “Product” class, add the following code:
Java
package com.example.entity;
import javax.persistence.*;

@Entity
@Table(name = "product")
public class Product {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(nullable = false)
    private String name;

    @Column(nullable = false)
    private double price;

    @Column(nullable = false)
    private int quantity;

    // Constructors, getters and setters, and other methods...

    // Getters
    public Long getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public double getPrice() {
        return price;
    }

    public int getQuantity() {
        return quantity;
    }

    // Setters
    public void setId(Long id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }
}

The @Entity annotation specifies that this class is an entity and should be mapped to a database table. The @Table annotation specifies the name of the database table that will store instances of this entity. The @Id annotation specifies the primary key of the entity, while the @GeneratedValue annotation specifies that the primary key should be generated automatically.

Step 4: Create Repository Interface

Now, we need to create a repository interface to handle database operations for the “Product” entity.

  • In the “ProductRepository” interface, add the following code:
Java
package com.example.springbootapi.repository;

import com.example.springbootapi.entity.Product;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

/**
 * Repository interface for Product entity.
 */
@Repository
public interface ProductRepository extends JpaRepository<Product, Long> {
}

The @Repository annotation specifies that this interface is a repository, and Spring will create an instance of it automatically. The JpaRepository interface provides a set of methods for performing CRUD (Create, Read, Update, Delete) operations on the “Product” entity.

Step 5: Create A Service Class

Next, we need to create a service class to handle the business logic for our REST API.

  • In the “ProductService” class, add the following code:
Java
package com.example.springbootapi.service;

import com.example.springbootapi.entity.Product;
import com.example.springbootapi.repository.ProductRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * Service class for managing Product entities.
 */
@Service
public class ProductService {

    private final ProductRepository productRepository;

    @Autowired
    public ProductService(ProductRepository productRepository) {
        this.productRepository = productRepository;
    }

    /**
     * Save a product.
     *
     * @param product the entity to save
     * @return the persisted entity
     */
    public Product saveProduct(Product product) {
        return productRepository.save(product);
    }

    /**
     * Get all the products.
     *
     * @return the list of entities
     */
    public List<Product> getAllProducts() {
        return productRepository.findAll();
    }

    /**
     * Get one product by ID.
     *
     * @param id the ID of the entity
     * @return the entity
     */
    public Optional<Product> getProductById(Long id) {
        return productRepository.findById(id);
    }

    /**
     * Update a product.
     *
     * @param id the ID of the entity
     * @param updatedProduct the updated entity
     * @return the updated entity
     */
    public Product updateProduct(Long id, Product updatedProduct) {
        Optional<Product> existingProduct = productRepository.findById(id);
        if (existingProduct.isPresent()) {
            Product product = existingProduct.get();
            product.setName(updatedProduct.getName());
            product.setPrice(updatedProduct.getPrice());
            product.setQuantity(updatedProduct.getQuantity());
            return productRepository.save(product);
        } else {
            throw new RuntimeException("Product not found");
        }
    }

    /**
     * Delete the product by ID.
     *
     * @param id the ID of the entity
     */
    public void deleteProduct(Long id) {
        productRepository.deleteById(id);
    }
}

For saving a product in the database we will use the following code:

// Save Product
public ResponseEntity<Product> saveProduct(@RequestBody Product product)
{
Product newProduct = productRepository.save(product);
return ResponseEntity.ok(newProduct);
}

For getting all products from the database we will use the following code:

// Get all products
public ResponseEntity<List<Product> > fetchAllProducts()
{
return ResponseEntity.ok(productRepository.findAll());
}

For getting a single product from the database we will use the following code:

// Get a product by ID
public ResponseEntity<Optional<Product> >
fetchProductById(Long id)
{
Optional<Product> product
= productRepository.findById(id);
if (product.isPresent()) {
return ResponseEntity.ok(product);
}
else {
return ResponseEntity.notFound().build();
}
}

For updating a single product from the database, we will use the following code:

public ResponseEntity<Product> updateProduct(Long id, Product updatedProduct)
{
if (id == null) {
throw new IllegalArgumentException(
"ID cannot be null");
}
Product Existingproduct
= productRepository.findById(id).orElseThrow(
()
-> new EntityNotFoundException(
String.valueOf(id)));
Existingproduct.setName(updatedProduct.getName());
Existingproduct.setPrice(updatedProduct.getPrice());
Existingproduct.setQuantity(
updatedProduct.getQuantity());
Product savedEntity
= productRepository.save(Existingproduct);
return ResponseEntity.ok(savedEntity);
}

For deleting a single product from the database, we will use the following code:

public ResponseEntity<String> deleteProduct(Long id)
{
productRepository.deleteById(id);
return ResponseEntity.ok(
"Product Deleted Successfully");
}

Step 6: Create Controller Class

Next, we need to create a controller class to handle HTTP requests for our REST API.

  • In the “ProductController” class, add the following code:
Java
package com.example.springbootapi.controller;

import com.example.springbootapi.entity.Product;
import com.example.springbootapi.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Optional;

@RestController
@RequestMapping("/api/v1")
public class ProductController {

    private final ProductService productService;

    @Autowired
    public ProductController(ProductService productService) {
        this.productService = productService;
    }

    /**
     * Create a new product.
     *
     * @param product the product to create
     * @return the ResponseEntity with status 200 (OK) and with body of the new product
     */
    @PostMapping("/product")
    public ResponseEntity<Product> saveProduct(@RequestBody Product product) {
        Product newProduct = productService.saveProduct(product);
        return ResponseEntity.ok(newProduct);
    }

    /**
     * Get all products.
     *
     * @return the ResponseEntity with status 200 (OK) and with body of the list of products
     */
    @GetMapping("/products")
    public List<Product> getAllProducts() {
        return productService.getAllProducts();
    }

    /**
     * Get a product by ID.
     *
     * @param id the ID of the product to get
     * @return the ResponseEntity with status 200 (OK) and with body of the product, or with status 404 (Not Found) if the product does not exist
     */
    @GetMapping("/products/{id}")
    public ResponseEntity<Product> getProductById(@PathVariable Long id) {
        Optional<Product> product = productService.getProductById(id);
        return product.map(ResponseEntity::ok).orElseGet(() -> ResponseEntity.notFound().build());
    }

    /**
     * Update a product by ID.
     *
     * @param id the ID of the product to update
     * @param product the updated product
     * @return the ResponseEntity with status 200 (OK) and with body of the updated product, or with status 404 (Not Found) if the product does not exist
     */
    @PutMapping("/products/{id}")
    public ResponseEntity<Product> updateProduct(@PathVariable Long id, @RequestBody Product product) {
        Product updatedProduct = productService.updateProduct(id, product);
        return ResponseEntity.ok(updatedProduct);
    }

    /**
     * Delete a product by ID.
     *
     * @param id the ID of the product to delete
     * @return the ResponseEntity with status 200 (OK) and with body of the message "Product deleted successfully"
     */
    @DeleteMapping("/products/{id}")
    public ResponseEntity<String> deleteProduct(@PathVariable Long id) {
        productService.deleteProduct(id);
        return ResponseEntity.ok("Product deleted successfully");
    }
}

The @RestController annotation specifies that this class is a controller for RESTful API requests. The @RequestMapping annotation specifies the base URL for all requests handled by this controller.

Next, we need to add methods to handle HTTP requests. In this example, we will add methods to handle GET, POST, PUT, and DELETE requests.

For Post Request, we will be using the following code:

  // Create a new Product
@PostMapping("/product")
public ResponseEntity<Product> saveProduct(@RequestBody Product product) {
Product newProduct = productService.saveProduct(product);
return ResponseEntity.ok(newProduct);
}

The @PostMapping annotation is used to indicate that this class will handle HTTP Post requests and return the response as JSON. It is used to map the /api/v1/products path to this class. @RequestBody is an annotation in Spring Framework used to bind the HTTP request body to a parameter in a controller method. When a client sends an HTTP POST or PUT request, it may include data in the request body. This data is typically in JSON or XML format and contains information about the resource being created or updated.

For Get Request all the products, we will be using the following code:

   // Get all Products
@GetMapping("/products")
public List<Product> getAllProducts() {
return productService.getAllProducts();
}

The @GetMapping annotation is used to indicate that this class will handle HTTP Get requests and return the response as JSON. It is used to map the /api/v1/products path to this class. Here the getAllProducts() method fetches all the products and has a path/products.

For Get Request of a single product, we will be using the following code:

 // Get a single product
@GetMapping("/products/{id}")
public ResponseEntity<Product> getProductById(@PathVariable Long id) {
Optional<Product> product = productService.getProductById(id);
return product.map(ResponseEntity::ok).orElseGet(() -> ResponseEntity.notFound().build());
}

The @PathVariable annotation is used to extract data from the URL path of an HTTP request. It is used to capture dynamic segments of a URL and map them to a method parameter in a Spring Boot controller. getProductById() method is used to get a product by id and has a path /products/{id}.

For Update Requests, we will be using the following code:

 // Update Product
@PutMapping("/products/{id}")
public ResponseEntity<Product> updateProduct(@PathVariable Long id, @RequestBody Product product) {
Product updatedProduct = productService.updateProduct(id, product);
return ResponseEntity.ok(updatedProduct);
}

In this example, we’ve added a @PutMapping annotation for the updateProduct() method. The @PutMapping annotation is used to map HTTP PUT requests to the /product/{id} endpoint, where {id} is a path variable for the product ID. The @RequestBody annotation is used to bind the request body to the product parameter in the method. When a PUT request is made to /api/v1/product/{id}, the updateProduct() method will be executed with the id parameter set to the product ID from the URL path and the product.

For Delete Requests, we will be using the following code:

 // Delete a Product
@DeleteMapping("/products/{id}")
public ResponseEntity<String> deleteProduct(@PathVariable Long id) {
productService.deleteProduct(id);
return ResponseEntity.ok("Product deleted successfully");
}

Now, we are completed with the programming side and just remain with the database and then test the endpoints and then we are done. First of all, we will have to configure MySql in our application.properties files. We will add the following code in the application.properties file.

spring.datasource.url=jdbc:mysql://localhost:3306/name of your database
spring.datasource.username=your username for mysql
spring.datasource.password=your password for mysql
spring.jpa.hibernate.ddl-auto=create-drop

Now, after this, we will test our API endpoints in postman. The default port for Spring Boot is 8080. You can change the port by using the command inside the application.properties file:

server.port=any port of your choice 

In this case, the port is 8080. In this case, for our Post Request, the endpoint will be like “ http://localhost:8080/api/v1/product ” and the output is:

Update The Products

For our Get Request, the endpoint will be like “ http://localhost:8080/api/v1/products ” and the output is:

Fetch the Products

For our Get by Id Request, the endpoint will be like “ http://localhost:8080/api/v1/products/{id} ” and the output is:

Fetch a single Product by ID

For our Update Request, the endpoint will be like “ http://localhost:8080/api/v1/products/{id} ” and the output is:

Update a single product by Id

And finally, for our Delete Request, the endpoint will be like “ http://localhost:8080/api/v1/products/{id}” and the output is:

Delete Product by ID

We made our Rest API in Spring Boot.



Previous Article
Next Article

Similar Reads

How to create a REST API using Java Spring Boot
Representational state transfer (REST) is a software architectural style that defines a set of constraints to be used for creating Web services. Web services that conform to the REST architectural style, called RESTful Web services, provide interoperability between computer systems on the Internet. RESTful Web services allow the requesting systems
6 min read
JSON using Jackson in REST API Implementation with Spring Boot
Whenever we are implementing a REST API with Spring (Spring Boot), we would have come across the requirement to exclude NULLs in the JSON Response of the API. Also, there might be a requirement to externalize turning ON/OFF this feature: Exclude NULLS in the JSON Response, thereby allowing the consumer of the API to customize as per the need. In th
3 min read
Spring Boot - REST API Documentation using OpenAPI
For any application, API documentation is essential for both users and developers. How to use an API, what will be the request body, and what will the API's response be? API documentation is the answer to all of these questions, springdoc-openapi is a Java library that automates the generation of the API documentation in both JSON/YAML and HTML for
4 min read
Spring Boot – REST API Documentation using Swagger
REST stands for Representational State Transfer. REST is an architectural design pattern that defines constraints that are used in web service development. Swagger is a framework in which we can test our REST APIs for different HTTP requests i.e. : GETPOSTPUTDELETEIn this article, we will be discussing using Swagger for documenting APIs in Spring B
4 min read
Spring Boot - How to set a Request Timeout for a REST API
In Microservice architecture, there are multiple microservices available for an application. For the application to work properly necessary services need to communicate with each other. There can be communication of messaging type or REST calls. How does REST API Work?In REST Calls the process is synchronous, which means suppose a service SERV1 is
7 min read
Spring Boot - Versioning a REST API
API Versioning is a defined process of making or managing changes to an API. These changes can be made transparently without interrupting the clients. When users have permission to decide whether they can conveniently upgrade to the latest version of API and clearly state the changes made is known as a Good API Versioning Strategy. When to Version
3 min read
Spring Boot – Using Spring Boot with Apache Camel
Apache Camel and Spring Boot are two powerful frameworks that can be seamlessly integrated to build robust, scalable, and efficient applications. Apache Camel is an open-source integration framework that provides an extensive range of components and connectors, enabling developers to integrate different systems, APIs, and applications. It simplifie
5 min read
Difference Between Spring Boot Starter Web and Spring Boot Starter Tomcat
Spring Boot is built on the top of the spring and contains all the features of spring. And is becoming a favorite of developers these days because of its rapid production-ready environment which enables the developers to directly focus on the logic instead of struggling with the configuration and setup. Spring Boot is a microservice-based framework
3 min read
Spring Boot – Handling Background Tasks with Spring Boot
Efficiently handling background tasks with Spring Boot is important for providing a smooth user experience and optimizing resource utilization. Background tasks refer to operations that are performed asynchronously or in the background, allowing the main application to continue processing other requests. In a Spring Boot application, background tas
5 min read
Java Spring Boot Microservices - Develop API Gateway Using Spring Cloud Gateway
The API Gateway Pattern in some cases stands for “Backend for frontend”. It is basically the entry gate for taking entry into any application by an external source. The pattern is going on in a programmer’s mind while they are making the client’s application. It acts as a medium between the client applications and microservices. For example-Netflix
4 min read
Spring Boot - Spring JDBC vs Spring Data JDBC
Spring JDBC Spring can perform JDBC operations by having connectivity with any one of jars of RDBMS like MySQL, Oracle, or SQL Server, etc., For example, if we are connecting with MySQL, then we need to connect "mysql-connector-java". Let us see how a pom.xml file of a maven project looks like. C/C++ Code &lt;?xml version=&quot;1.0&quot; encoding=
4 min read
Spring vs Spring Boot vs Spring MVC
Are you ready to dive into the exciting world of Java development? Whether you're a seasoned pro or just starting out, this article is your gateway to mastering the top frameworks and technologies in Java development. We'll explore the Spring framework, known for its versatility and lightweight nature, making it perfect for enterprise-level softwar
8 min read
Migrating a Spring Boot Application from Spring Security 5 to Spring Security 6
Spring Security is a powerful authentication and access control framework for Java applications specially for those built with the Spring Framework. With the release of Spring Security 6, several enhancements and changes have been introduced to simplify the security configuration and provide better performance and security features. This article ai
4 min read
How to Build a RESTful API with Spring Boot and Spring MVC?
RESTful APIs have become the standard for building scalable and maintainable web services in web development. REST (Representational State Transfer) enables a stateless, client-server architecture where resources are accessed via standard HTTP methods. This article demonstrates how to create a RESTful API using Spring Boot and Spring MVC. We will w
7 min read
How to Make REST Calls using FeignClient in Spring Boot?
Representational State Transfer (REST) is an architectural style that defines a set of constraints to be used for creating web services. REST API is a way of accessing web services in a simple and flexible way without having any processing. FeignClient also known as Spring Cloud OpenFeign is a Declarative REST Client in Spring Boot Web Application.
13 min read
Securing Spring Boot API With API Key and Secret
In Web applications, securing the APIs is critical. One of the common methods of securing the APIs is by using API keys and secrets. This ensures that only the authorized clients can access the API endpoints. This article can guide you through the process of securing the Spring Boot API using the API keys and secrets. Securing the Spring Boot API w
6 min read
Spring Boot - REST Example
We all know in today's world, most web app follows the client-server architecture. The app itself is the client or frontend part under the hood it needs to call the server or the backend to get or save the data this communication happens using HTTP protocol the same protocol is the power of the web. On the server, we expose the bunch of services th
4 min read
Spring Boot - Rest Template
RestTemplate is a powerful synchronous client for handling HTTP communication in Spring Boot applications. It internally uses an HTTP client library i.e. java.net.HttpURLConnection, simplifying the process of making RESTful requests to external services and APIs, including convenience, along with integration, and flexibility for various HTTP commun
7 min read
How to Call REST Services with WebClient in Spring Boot?
Representational State Transfer (REST) is an architectural style that defines a set of constraints to be used for creating web services. REST API is a way of accessing web services in a simple and flexible way without having any processing. Spring WebClient is a non-blocking and reactive web client to perform HTTP requests. It is also the replaceme
11 min read
Spring Boot: Cannot access REST Controller on localhost (404)
The Spring Boot framework is one of the most famous in web application development, It can provide a lot of features to make development easy like dependency management, Spring Security, Spring Autoconfiguration, and other features provided by the Spring Framework. In this article, we will learn how a 404 error occurs while accessing the REST Contr
4 min read
Best Practices while Making Rest APIs in Spring Boot Application
API, or Application Programming Interface, is a communication gateway between frontend and backend code. A robust API is crucial for ensuring uninterrupted functionality. In this article, we will discuss how to achieve robustness in our REST API within the Spring Boot application. Rules : Use JSON as the Standard Message FormatError HandlingPaginat
7 min read
How to Generate Spring Boot REST Client with Swagger?
Spring Boot is a powerful framework for building Java applications, particularly RESTful web services. When developing the REST APIs, it can be crucial to provide documentation that is both user-friendly and interactive. Swagger is an open-source that simplifies this by generating the API documentation automatically. In this article, we will create
6 min read
Spring Boot – Building REST APIs with HATEOAS
In this article, we will explore how to build RESTful APIs using the Spring Boot with HATEOAS (Hypermedia as the Engine of Application State). HATEOAS is the key component of the REST application architecture, where each resource not only provides the data but also includes links to other actions that can be performed on the resource. This approach
5 min read
How to Create Todo List API using Spring Boot and MySQL?
Spring Boot is built on the top of the spring and contains all the features of spring. And is becoming a favorite of developers these days because of its rapid production-ready environment which enables the developers to directly focus on the logic instead of struggling with the configuration and setup. Spring Boot is a microservice-based framework
6 min read
Best Way to Master Java Spring Boot Microservices – A Complete Roadmap
The World is Moving Towards Microservices Architecture. Yes, it's true but why? Microservices are becoming more popular day by day. To know Why the World is Moving Towards Microservices Architecture you must refer to this article. This will give you a complete idea of why big organizations like Google, Meta, Twitter, etc. are using Microservices no
6 min read
Best Way to Master Spring Boot – A Complete Roadmap
In the corporate world, they say "Java is immortal!". But Why? Java remains one of the major platforms for developing enterprise applications. Enterprise Applications are used by large companies to make money. Those applications have high-reliability requirements and an enormous codebase. According to a Java Developer Productivity Report, 62% of su
14 min read
How to Create a Spring Boot Project in Spring Initializr and Run it in IntelliJ IDEA?
Java language is one of the most popular languages among all programming languages. There are several advantages of using the java programming language, whether for security purposes or building large distribution projects. One of the advantages of using Java is that it tries to connect every concept in the language to the real world with the help
3 min read
How to Create and Setup Spring Boot Project in Spring Tool Suite?
Spring Boot is built on the top of the spring and contains all the features of spring. And is becoming a favorite of developers these days because of its rapid production-ready environment which enables the developers to directly focus on the logic instead of struggling with the configuration and setup. Spring Boot is a microservice-based framework
3 min read
Spring MVC - Get Probability of a Gender by Providing a Name using REST API
A lot of funful REST API calls are available as open source. Suppose if we like to keep a name to our nears and dears, we can just check that by means of a REST API call and get the gender, what is the probability of being that gender and how many times does it come with it? Relevant REST API call https://api.genderize.io?name=&lt;Provide your desi
7 min read
OpenSource REST API URL and Retrieving Data From it By Using Spring MVC
In this internet era, a lot of helper services are available in the form of REST API and mostly REST API provides us the details in the form of JSON/XML. We can use them in our applications and render the data as we like. Here is the list of a few opensource REST API URLs: API NameDescriptionURLCoinGeckoExchange rates https://api.coingecko.com/api/
6 min read