Skip to main content

Spring Boot Introduction

Spring Boot is the extension of Spring framework including all the features of Spring. Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can just run. Spring Boot is becoming favorite of developers nowadays, because of it’s a rapid production-ready environment which enables the developers to directly focus on the logic instead of struggling with the configuration and set up in very less time.
It is mostly used to create Micro-Services.

1. Why Spring Boot is evolved?

Spring makes programming Java quicker, easier, and safer for everybody. Spring's focus on speed, simplicity, and productivity has made it the world's most popular Java framework. It's MVC architecture that is a widely used module of spring, used to create scalable web applications.
 
But the most stumbling block of the spring projects is the configuration that takes a lot of time and concentration to focus on. Making the application ready for production takes some time if you are new to the spring.
To counter this problem Spring Boot is evolved.

2. Goals of Spring Boot 

Spring Boot is designed with the following goals −

  • To avoid complex XML configuration in Spring
  • To develop  production-ready Spring applications in an easier way
  • To reduce the development time and run the application independently
  • Offer an easier way of getting started with the application

3. Features of Spring Boot

You can choose Spring Boot because of the features and benefits it offers as given here −

  • It provides a flexible way to configure Java Beans, XML configurations, and Database Transactions.

  • It provides powerful batch processing and manages REST endpoints.

  • In Spring Boot, everything is auto-configured; no manual configurations are needed.

  • It offers an annotation-based spring application

  • Eases dependency management

  • It includes Embedded Servlet Container

4. Advantages of Spring Boot

  • Easy to understand and develop applications
  • Increases productivity
  • Reduces the development time
  • Simplified & version conflict-free dependency management through the starter POMs.
  • 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.

5. Spring Boot Disadvantages

  1. Spring boot may unnecessarily increase the deployment binary size with unused dependencies.
  2. If you are a control freak, I doubt Spring Boot would fit your needs.
  3. Spring Boot sticks well with microservices. The Spring Boot artifacts can be deployed directly into Docker containers. In large and monolithic based applications, I would not encourage you to use Spring Boot.

6. Components of Spring Boot

The whole application logic revolves around its components. There are three main components of Spring Boot :

  1. Controller
    It is responsible to handle user request and return appropriate response.
  2. Service 
    Here we implement the business logic of the application
  3. Repository
    Here we write the logics to perform datbase transaction on data ( save, updadate and retrieve)

7. Prerequisites to get started with Spring Boot

The only prerequisite for learning any java based framework is  Java itself. So before getting started with the Spring Boot, you must have strong knowledge on:-

I. Core Java

Concepts related to 

  1. OOP Concepts,
  2. Method overloading
  3. Method overriding
  4. Abstract class
  5. Interface
  6. Collections
  7. Exceptions

II. J2EE 

You must have a little bit of knowledge of J2EE related technologies like:-

  1. Servlet
  2. JSP
  3. JDBC
  4. Web-technologies (HTML, CSS, Javascript)

And additionally some design patterns like 

        Strategy, Singleton, Factory and MVC architecture

 Learn at least how to write a Servlet program and how to configure the servlet. Must have knowledge on how to connect the database using JDBC and at least know simple CRUD operations, must have knowledge on one database.

For more deep knowledge and for cracking interviews you may learn about spring modules like:-

  • Spring Core
  • Spring MVC
  • Spring Data etc etc

As Spring Boot is built on top of Spring framework, for working into Spring boot you don't need to know all of these modules. This would also take a lot of time. So start from Spring core and then jump into others according to your interest.

Then it will be very interesting to learn spring boot.

For setting up a project you need to set a directory structure, properties file, build file with dependencies, testing codes and many more things required before getting started for actual coding. But do not worry about this? we have Spring Initializr to do the same, only you need just 5  min to understand it forever, click next to go to Spring Intializr.

Popular posts from this blog

How to Implement AWS RDS Database IAM Authentication in Spring Boot

Amazon RDS for MySQL allows authentication using AWS Identity and Access Management (IAM) database authentication. With this authentication method, you don't need to use a password when you connect to a DB instance. Instead, you use an authentication token. Let us understand how this works? An authentication token is a unique string of characters that Amazon RDS generates on request. Authentication tokens are generated using AWS Signature Version 4. Each token has a lifetime of 15 minutes. You don't need to store user credentials in the database, because authentication is managed externally using IAM. You can also still use standard database authentication. Since IAM authentication tokens are short-lived access tokens that are valid for 15 minutes. For the RDS database this token works as a database password that is required to establish a connection and does not determine how long the existing connection can last. The default value for connection to be alive without activit...

What Is SSL Certificate and how it works?

Deep Dive into SSL Certificate What Is an SSL Certificate? SSL (Secure Sockets Layer) is the common name for TLS (Transport Layer Security), a security protocol that enables encrypted communications between two machines. An SSL certificate is a small data file leveraging this security protocol to serve two functions: Authentication – SSL certificates serve as credentials to authenticate the identity of a website. They are issued to a specific domain name and web server after a Certificate Authority, also known as a Certification Authority (CA), performs a strict vetting process on the organization requesting the certificate. Depending on the certificate type, it can provide information about a business or website's identity and authenticate that the website is a legitimate business. Secure data communication - When SSL is installed on a web server, it enables the padlock to appear in the web browser. It activates the HTTPS protocol and creates a secure connection between th...

How to configure SSL certificate in spring boot?

Let us learn how to generate & configure the ssl certificates in spring boot applications. Step 1. Getting the certificate  We can purchase the SSL certificate from the following SSL providers   Godaddy DigiCert GeoTrust GlobalSign Comodo SSL RapidSSL SSL.com OR, for testing purposes, we can generate a self-signed certificate Before getting started, let us know the format of the SSL certificates: PKCS12:  Public Key Cryptographic Standards is a password-protected format that can contain multiple certificates and keys; it's an industry-wide used format. JKS:  Java KeyStore  is similar to PKCS12; it's a proprietary format and is limited to the Java environment. To know more about how SSL works please go to this link . We can use either keytool or OpenSSL tools to generate the certificates from the command line. Keytool  is shipped with Java Runtime Environment, and OpenSSL can be downloaded from  here . For our demonstratio...

How to upload files in Amazon S3 Bucket using Spring Boot

As stated in the title, we are going to demonstrate that how we can upload and retrieve files from the amazon s3 bucket in spring boot. For this, we must have an account on amazon web services (AWS) . And the next thing you need to have is an IAM user that has programmatic access to the s3 bucket. Follow the steps below to create an IAM user and s3 bucket. Table of Contents 1. Steps to create an IAM user in AWS with S3 bucket full access permission Step 1.1 Login to your AWS account   Step 1.2 Set the user details Step 1.3 Set user permissions Step 1.4 Create a user group and set the access policy Step 1.5 Add user to the group Step 1.6  Set the tags (optional) Step 1.7  Review the user details and permission summary Step 1.8 Download the user credentials 2. See, how to create s3 bucket. Step 2.1 Click on the "Create bucket" button. Step 2.2 Enter the bucket name and select bucket region. Step 2.3 Set file accessibility for bucket items as publi...

How to Implement Spring Security in Spring Boot

Security Example in Spring Boot Implementation of Spring Security in the Spring Boot application is the key point to learn for spring boot developers. Because Authentication and Authorization are the backbones of the whole application. Getting started with the Spring Security Series, this is the first part, in this article we are going to focus on the authentication part with minimal registration. The implementation of registration flow with email verification, customizing password encoding, and setting up password strengths and rules will be explored in another separate article for each.  This article will be the base of the spring security series, the other security features will be explained on the basis of this implementation, so be focused and let's understand. The code contains proper naming & brief comments that makes it very comprehensive. If you feel any difficulty or find any issue, please drop a comment below this post The main goal of this article is to impleme...

Basic Annotations in Spring Boot

Annotations are the key components. Spring Boot annotations are simple and self-explanatory. There are a large number of annotations are implemented in Spring  Core. But In Spring Boot most of the annotations are enhanced and combined in simpler ones to write fewer lines of code. For example: If you are ever worked with spring core you need to apply @Configuration , @EnableAutoConfiguration and @ComponentScan . Now In Spring Boot, these three are combined into @SpringBootApplication . Here we have listed 32 annotations and explained, in brief, what every beginner should know. If you understand the use and start playing with these annotations no one can stop you to become a master in spring boot. We will provide the detailed example later on so please subscribe to this blog from the footer section by providing an email id: Table of Contents Basic Annotations in Spring Boot 1.@SpringBootApplication 2.@Component 3.@Service 4.@Repository 5.@Controller 6.@RestController ...

Application Properties And Environment Profiling In Spring Boot

Application Properties As we know Spring Boot configures almost all the configurations automatically, it also enables us to customize the configurations and properties according to our needs and environment. There are various methods which we can use to do the same. We can either write all properties in a textual file, do programmatically in our Java classes, or can set it while starting the application through CLI by passing command-line arguments. By default, Spring Initializr creates an application.properties file inside the project's class path. But we can also define it in the YAML file. Know the differences between the .properties file and .yml file The properties that we are talking about are database credentials and URL, server port, logging file path, catch control variables, can write any custom string constants, etc. Table of Contents Application Properties  Method 1: Using application.properties  Method 2: Using application.yml file  Method 3...

Understanding - Spring Initializr

The Spring Initializr is ultimately a web application that generates a Spring Boot project structure for you. It can be used from different interfaces. From Web-based interface ( https://start.spring.io or https://start-scs.cfapps.io ) From supported IDE s STS , Eclipse , Netbeans , Intellij Idea . In the case of Eclipse, you need to install a plugin 'STS'. From CLI (Command Line Interface) Web-Based UI  (the same interface is opened in supported IDEs )   Project: Maven or Gradle          This is the selection of the project built tool or Dependency Manager that is used to manage all the dependencies added in the projects and to compile and pack the project in selected packaging ( jar or war ). If you want to know more about the selection of built tool and comparison between Maven and Gradle click the below link. What to choose Maven or Gradle?   Language: This section will is used to select the language in which you are comfortabl...

Request Mapping Annotation in Spring Boot

The @RequestMapping is a class level  (also called type level) and method level annotation, it is used to process HTTP requests with specified URL patterns. It is used in and along with both @Controller and @RestController . Table of Contents Request Mapping Annotation in Spring Boot 1. How @RequestMapping annotation it is used? 2. Optional Elements of @RequestMapping 2.1 name, value and path 2.2 headers, consumes and produces 3. Specialization of @RequestMapping 1. How @RequestMapping annotation it is used? @Controller @RequestMapping("/student") public class StudentController{ @RequestMapping("/dashboard") public String dashboard(){ return "dashboard"; } @RequestMapping("result") public String result(){ return "result"; } } We can see in above code sample "/student" , "/dashboard" and "result" passed with annotation are called request value/path present in the URL ...