Beginner tutorial on building and running RESTful Web Services with HTTP CRUD operations using Spring Boot
In this tutorial we are going to learn about RESTful Web Services and implementing them with the best practices and perform basic crud operations on user details like create, read, update and delete.
These are the important topics that must be covered while preparing for a Java interview on Spring Boot and Restful web services.
Upon completion of this course, who have never build RESTful Web Services. It will guide you step-by-step through basics and will help you create and run RESTful Web Services from scratch.
Spring Boot is a project that is built on the top of the Spring Framework. It provides an easier and faster way to set up, configure, and run both simple and web-based applications.
It is a Spring module that provides the RAD (Rapid Application Development) feature to the Spring Framework. It is used to create a stand-alone Spring-based application that you can just run because it needs minimal Spring configuration.
In short, Spring Boot is the combination of Spring Framework and Embedded Servers.
In Spring Boot, there is no requirement for XML configuration (deployment descriptor). It uses convention over configuration software design paradigm that means it decreases the effort of the developer.
We can use Spring STS IDE or Spring Initializr to develop Spring Boot Java applications.
We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need minimal Spring configuration.
If you’re looking for information about a specific version, or instructions about how to upgrade from an earlier release, check out the project release notes section on our wiki.
- Create stand-alone Spring applications
- Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)
- Provide opinionated ‘starter’ dependencies to simplify your build configuration
- Automatically configure Spring and 3rd party libraries whenever possible
- Provide production-ready features such as metrics, health checks, and externalized configuration
- Absolutely no code generation and no requirement for XML configuration
Spring Boot Advantages
- Simplified & version conflict free dependency management through the starter POMs.
- We can quickly setup and run standalone, web applications and micro services at very less time.
- You can just assemble the jar artifact which comes with an embedded Tomact, Jetty or Undertow application server and you are ready to go.
- Spring Boot provides HTTP endpoints to access application internals like detailed metrics, application inner working, health status, etc. -No XML based configurations at all. Very much simplified properties. The beans are initialized, configured and wired automatically.
- The Spring Initializer provides a project generator to make you productive with the certain technology stack from the beginning. You can create a skeleton project with web, data access (relational and NoSQL datastores), cloud, or messaging support.
Spring Boot Disadvantages
- Spring boot may unnecessarily increase the deployment binary size with unused dependencies.
- If you are a control freak, I doubt Spring Boot would fit your needs.
- Spring Boot sticks good with micro services. The Spring Boot artifacts can be deployed directly into Docker containers. In a large and monolithic based applications, I would not encourage you to use Spring Boot.
Components of Spring Boot
The whole application logic revolves around its components. There are three main components of Spring Boot :
- Controller: It is responsible to handle user request and return appropriate response.
- Service: Here we implement the business logic of the application
- Repository: Here we write the logics to perform datbase transaction on data ( save, updadate and retrieve)
- Spring Modules
- Spring Boot Architecture
- Difference between Spring, Spring Boot and Spring MVC
- What are RESTful Web Services
- Difference between REST and SOAP Web Services
- How to Design a RESTful Web Service
- Difference between HTTP and HTTPS
- HTTP headers Accept and ContentType in Restful web services
- Generate a project using Spring Boot Initializr
- Building a Rest Controller in Spring Boot
- Rest Controller with POST, GET, PUT, DELETE Mappings
- @PathVariable annotation in Spring Boot
- @RequestParam annotation in Spring Boot
- Returning Java object as a return value in Spring Boot
- Returning object as XML or JSON with Produces in Spring Boot
- Returning HTTP status codes from Rest Controller in Spring Boot
- Reading XML or JSON payload from HTTP POST using consumes in Spring Boot
- HTTP POST request using hibernate bean validations in Spring Boot
- HTTP GET request to store user details temporarily in a Map Spring Boot
- HTTP PUT request to update user details in Spring Boot
- HTTP DELETE request to delete user details in Spring Boot
- Handling exceptions and returning custom error message in Spring Boot
- Dependency Injection using @Autowired Annotation in Spring Boot
- Spring Boot Scheduling and its implementation
- Enabling HTTPS using SSL in a spring boot application