Spring Boot -Part 1 (Understanding Basics)

Janit Bidhan
5 min readApr 7, 2023

--

“Spring Boot takes care of the little things, so you can focus on building big things.”

As a software developer, I have always been on the lookout for technologies that simplify and accelerate the development process. And Spring Boot has been a game-changer for me. It is an open-source Java framework that allows me to quickly build and deploy web applications.

One of the things I love about Spring Boot is its convention-over-configuration approach. With this approach, I don’t have to worry about configuring every aspect of the application manually. Instead, Spring Boot provides a set of sensible defaults that work for most applications. This frees up a lot of time that I can use to focus on writing the core business logic of the application.

Another great feature of Spring Boot is its embedded server. It comes with an embedded Tomcat server that allows me to run my application as a standalone JAR file. This means that I don’t have to worry about setting up a separate web server like Apache or Nginx. It also makes it easier to deploy my application to cloud platforms like Heroku or AWS.

Spring Boot also has a rich ecosystem of plugins and libraries that make it easy to integrate with other technologies. For example, I can easily integrate Spring Boot with popular frontend frameworks like Angular or React using plugins like Spring Boot DevTools and Spring Data REST. This allows me to build full-stack web applications with ease.

As a developer, I also appreciate the robustness of the Spring framework. It has a proven track record in the industry and has been around for over a decade. This means that it has a large community of developers who contribute to the framework and provide support. The Spring community is also very active, which means that I can easily find answers to my questions on forums like Stack Overflow.

Let’s dive into the basics together and get you up and running with the powerful tool.

Introduction to Spring

> Java Spring Framework (Spring Framework) is a popular, open-source, enterprise-level framework for creating standalone, production-grade applications that run on the Java Virtual Machine (JVM).

> Spring handles the infrastructure so you can focus on your application.

> Spring enables you to build applications from “plain old Java objects” (POJOs) and to apply enterprise services non-invasively to POJOs. This capability applies to the Java SE programming model and to full and partial Java EE.

Main Concepts that might be known before beginning our journey with Spring Boot

Introduction to Spring Boot

Java Spring Boot (Spring Boot) is a tool that makes developing web applications and microservices with Spring Framework faster and easier through three core capabilities:

1. Autoconfiguration: Spring Boot comes with built-in autoconfiguration capabilities, automatically configuring both the underlying Spring Framework and third-party packages based on your settings, which reduces the possibility of human errors.

2. An opinionated approach to the configuration: Spring Boot uses an opinionated approach to adding and configuring starter dependencies, based on the needs of your project, by choosing which packages to install and which default values to use.

3. The ability to create standalone applications: Spring Boot lets you create standalone applications that run on their own, without relying on an external web server, by embedding a web server such as Tomcat or Netty into your app during the initialization process.

These features work together to provide you with a tool that allows you to set up a Spring-based application with minimal configuration and setup.

Spring Boot Framework reduces Development time, Developer Effort, and increases productivity.

Spring compared to Spring Boot

In summary, the major differences between Spring and Spring Boot are that Spring is a comprehensive and modular framework that requires manual configuration and has a longer development time, while Spring Boot is a lightweight framework with sensible defaults and conventions that provides a shorter development time.

Spring Boot is derived from Spring, this diagram sums it up:

Annotations

Annotations are a form of metadata that provide additional information about Java code to the compiler, runtime environment, or other tools. Annotations are used in Spring Boot to configure and customize various aspects of the application.

> @SpringBootApplication: annotation is used to bootstrap a Spring Boot application. It is a combination of @Configuration, @EnableAutoConfiguration, and @ComponentScan.

> @Autowired is used for dependency injection.

> @Component: used to mark a class as a Spring Bean. It tells Spring to manage the lifecycle of the bean and to inject its dependencies.

> @Service: is typically used to define a business logic layer in a Spring application.

> @RestController is used to create RESTful web services, and @RequestMapping is used for mapping HTTP requests to controller methods.

> Annotations like @Repository and @Transactional are used for database access, while @Configuration and @EnableAutoConfiguration are used for application configuration.

> Annotations like @SpringBootTest and @MockBean are used for testing.

In my experience, I’ve found that there’s no substitute for hands-on learning. While reading about a concept or tool can be helpful, it’s only when you dive in and start working with it that you truly begin to understand its potential. That’s why I’m excited to share with you my personal journey of building an application using Spring Boot and Spring Data.

In the upcoming part, I’ll walk you through the steps of building a Spring Boot application from scratch, using Spring Data to interact with a database. I’ll share my own tips and tricks that I’ve learned along the way, as well as some common pitfalls to avoid. By the end of it, you’ll have a solid foundation in building applications with Spring Boot and Spring Data, and you’ll be ready to take on more advanced projects in the future.

References:

  1. https://spring.io/
  2. https://www.javatpoint.com/spring-boot-tutorial

--

--

Janit Bidhan

Former SWE Intern @Google | Former SWE @Oracle | MS CS GMU | PSM-I | SDE | ML | POLYGLOT PROGRAMMER | EXUBERANT LEARNER https://www.linkedin.com/in/janitbidhan/