0% found this document useful (0 votes)
9 views14 pages

Commonly Used Spring Boot Starters, Classes, Interfaces - by Suresh Kumar - Medium

The document discusses commonly used Spring Boot starters, classes, and interfaces, providing an overview of essential dependencies for Java applications. Key starters include spring-boot-starter-web, spring-boot-starter-data-jpa, and spring-boot-starter-security, among others. It also highlights important classes and interfaces such as ResponseEntity, CommandLineRunner, and RestTemplate that facilitate application development and interaction with databases and APIs.

Uploaded by

cdmmdc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views14 pages

Commonly Used Spring Boot Starters, Classes, Interfaces - by Suresh Kumar - Medium

The document discusses commonly used Spring Boot starters, classes, and interfaces, providing an overview of essential dependencies for Java applications. Key starters include spring-boot-starter-web, spring-boot-starter-data-jpa, and spring-boot-starter-security, among others. It also highlights important classes and interfaces such as ResponseEntity, CommandLineRunner, and RestTemplate that facilitate application development and interaction with databases and APIs.

Uploaded by

cdmmdc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Commonly used Spring Boot Starters, Classes, Interfaces | by Suresh Kumar | Medium https://medium.com/@sureshkumar_95502/spring-boot-starters-classes-interfaces-part-1-160...

Search Write

Commonly used Spring Boot


Starters, Classes, Interfaces
Suresh Kumar · Follow
4 min read · Feb 13, 2023

In my previous post on Spring Boot Annotations, we have seen commonly


used Spring, Spring Boot Annotations. In this post lets explore the
commonly used Spring, Spring Boot maven starter dependencies, classes
and interfaces(excluding annotations).

1 of 14 12/26/2024, 3:58 PM
Commonly used Spring Boot Starters, Classes, Interfaces | by Suresh Kumar | Medium https://medium.com/@sureshkumar_95502/spring-boot-starters-classes-interfaces-part-1-160...

Spring Boot Starters, Classes, interfaces

As known, we can start using Spring, Spring Boot in Java application, by


adding related Spring, Spring Boot starter dependencies in pom.xml(for
Maven Projects).

Below are most commonly used Spring Boot dependencies.

a) spring-boot-starter-web — includes Spring Core, MVC, REST API related


dependencies, including Apache Tomcat Web Server
b) spring-boot-starter-data-jpa — includes Hibernate ORM and related

2 of 14 12/26/2024, 3:58 PM
Commonly used Spring Boot Starters, Classes, Interfaces | by Suresh Kumar | Medium https://medium.com/@sureshkumar_95502/spring-boot-starters-classes-interfaces-part-1-160...

Spring Boot functionality to interact with RDBMS databases


c) spring-boot-starter-validation — provides validation related functionality
d) spring-boot-starter-test — provides Test related functionality
e) spring-boot-starter-aop — provides Aspect Oriented programming
f) spring-boot-starter-security — provides Authentication, Authorization,
Security Filters
g) spring-boot-starter-actuator — provides actuator which is useful in
remote health monitoring of running Spring Boot application
h) spring-boot-devtools — provides remote debugging, automatic live reload
of project, whenever source code changes are saved(this saves development
time, by avoiding manual restart of running project)

i) spring-boot-starter-webflux — Used to develop reactive, non-blocking


REST API end points

There are many other such Spring boot starter dependencies, for example
for interacting with Mongo DB, Kafka Messaging, etc…

A new Spring boot application can be created by

1. visiting Spring Initializr(https://start.spring.io/), and selecting required


dependencies(i..e starter packages), and download sample Project, to

3 of 14 12/26/2024, 3:58 PM
Commonly used Spring Boot Starters, Classes, Interfaces | by Suresh Kumar | Medium https://medium.com/@sureshkumar_95502/spring-boot-starters-classes-interfaces-part-1-160...

which developers can add required business logic.

2. STS(Spring Tool Suite) provides default support to create Spring Boot


application by adding required dependencies, such as above. For this,
other IDEs such as Eclipse, Intellij needs appropriate plugin to be
installed.

3. other way is, such starter dependencies can be added manually, to a


Maven project.

Spring Boot Classes, interfaces: Once starter dependencies such as above


are added, Spring Boot framework can be used in your Applications either by

a) specifying appropriate Spring Boot Annotations(these we have explored in


my previous blog post)

b) using Spring Boot classes or interfaces(commonly used Spring boot


classes or interfaces are mentioned below)

c) using Configurations in application.properties(I will be briefing this in my

4 of 14 12/26/2024, 3:58 PM
Commonly used Spring Boot Starters, Classes, Interfaces | by Suresh Kumar | Medium https://medium.com/@sureshkumar_95502/spring-boot-starters-classes-interfaces-part-1-160...

next posts)

Lets explore Spring, Spring Boot’s classes or interfaces

BeanFactory & ApplicationContext — These classes are generally used to


specify Configuration classes and to explicitly request creation of a bean,
these both classes are bit rarely used(directly), in application development.

ResponseEntity<> — a Generic class, which bundles the HTTP response sent


back to Client. With ResponseEntity you can specify

a. Http status code

b. Http Headers

c. Response Body

CommandLineRunner — interface with run( ) method declaration —


override run( ) with functionality which need to be executed, immediately
after Spring Container is ready.

UriBuilder — to create flexible urls along with Path Variables, Query

5 of 14 12/26/2024, 3:58 PM
Commonly used Spring Boot Starters, Classes, Interfaces | by Suresh Kumar | Medium https://medium.com/@sureshkumar_95502/spring-boot-starters-classes-interfaces-part-1-160...

Parameters. These Urls are used, to further invoke REST APIs, from Spring
Boot Application.

CrudRepository — interface with methods declared, that facilitates


application to interact with any RDBMS database to perform CRUD
operations

PagingandSortingRepository — interface which is derived from


CrudRepository, and additionally provides method declarations for paging
and sorting related functionality

JpaRepository — interface which is derived from CrudReposiotory,


additionally provides method declarations for Paging and sorting related
functionality, and batch related operations

Pageable, Page, Sort — classes or interfaces which lets to customize Sorting


and Paging functionality, such as ascending, descending, page size, sort
based on multiple criteria, etc…

WebSecurityConfigurerAdapter — derived class of this class, is used to


specify Security related Configurations

6 of 14 12/26/2024, 3:58 PM
Commonly used Spring Boot Starters, Classes, Interfaces | by Suresh Kumar | Medium https://medium.com/@sureshkumar_95502/spring-boot-starters-classes-interfaces-part-1-160...

AuthenticationManagerBuilder — used to specify source of Authentication


details, type of Authentication source, encryption algorithm.

SecurityContext, SecurityContextHolder — SecurityContext class holds


details of currently authenticated(or logged in) User. And
SecurityContextHolder is helper class to provide us SecurityContext.

HttpSecurity — used to specify rules to restrict access of URLs or URL


patterns, Security Filter class(es), etc…

UserDetails,UserDetailsService — UserDetails stores details of currently


logged in User. UserDetailsService provides us UserDetails

RestTemplate — to consume REST API end points exposed by other


Microservices of the Application or external sources. RestTemplate is
blocking in nature, use WebClient to develop reactive, non blocking client.

DataSource — holds details of a data source such as a database, with which


application interacts

7 of 14 12/26/2024, 3:58 PM
Commonly used Spring Boot Starters, Classes, Interfaces | by Suresh Kumar | Medium https://medium.com/@sureshkumar_95502/spring-boot-starters-classes-interfaces-part-1-160...

MockMvc — MockMvc is a utility class that lets us send mock HTTP requests,
for Testing REST API end points.

There are many more classes and interfaces provided by Spring & Spring
Boot, in this post I have mentioned most commonly used classes and
interfaces, only.

I will be adding few important code snippets showing usage of above classes
or interfaces, in second part of this post, shortly.

My other Blog Posts:

Spring, Spring Boot Annotations Cheat sheet


As known there are a number of Annotations provided by Java’s
Spring, Spring Boot Framework, and it would be quite…
medium.com

8 of 14 12/26/2024, 3:58 PM
Commonly used Spring Boot Starters, Classes, Interfaces | by Suresh Kumar | Medium https://medium.com/@sureshkumar_95502/spring-boot-starters-classes-interfaces-part-1-160...

How to create Custom Java Collection by extending from an


existing Collection class
Though Core Java provides a number of builtin Collections such as
ArrayList, LinkedList, HashSet, etc…., sometimes it…
medium.com

https://medium.com/@sureshkumar_95502/angular-cheat-sheet-b542fc75ddf

Spring Boot Starter Spring Boot Classes Spring Boot Interfaces

Spring Boot Cheat Sheet Spring Cheat Sheet

Written by Suresh Kumar Follow


197 Followers · 1 Following

With about 23 Years of experience in Software development, currently into


Corporate Training on Java Full Stack, Microservices, Angular, Design Patterns

9 of 14 12/26/2024, 3:58 PM
Commonly used Spring Boot Starters, Classes, Interfaces | by Suresh Kumar | Medium https://medium.com/@sureshkumar_95502/spring-boot-starters-classes-interfaces-part-1-160...

No responses yet

What are your thoughts? Respond

More from Suresh Kumar

10 of 14 12/26/2024, 3:58 PM
Commonly used Spring Boot Starters, Classes, Interfaces | by Suresh Kumar | Medium https://medium.com/@sureshkumar_95502/spring-boot-starters-classes-interfaces-part-1-160...

Suresh Kumar Suresh Kumar

Java Collections Cheat Sheet Microservices Spring Cloud Cheat


This post gives you a quick and good Sheet
reference/recap of complete Java Collection… Advantages of Microservices architectures
Flexible & independent release life cycle,…

Dec 7 Jun 21, 2023 86

Suresh Kumar Suresh Kumar

JUnit5 Cheatsheet How to fix StackOverflowError in


Learn JUnit5 in 15 minutes Java?
What is StackOverflowError and different
solutions to fix it?

Dec 14 5 Dec 16

See all from Suresh Kumar

11 of 14 12/26/2024, 3:58 PM
Commonly used Spring Boot Starters, Classes, Interfaces | by Suresh Kumar | Medium https://medium.com/@sureshkumar_95502/spring-boot-starters-classes-interfaces-part-1-160...

Recommended from Medium

In AlgoMaster.io by Ashish Pratap Singh Ramesh Fadatare

How I Tricked My Brain to Be Spring Boot Security JWT


Addicted to Coding Authentication Tutorial
The Dopamine Hack In this tutorial, you will learn how to use JWT
(JSON Web Token) authentication in a Sprin…

Nov 15 3.6K 83 Oct 5 15

Lists

12 of 14 12/26/2024, 3:58 PM
Commonly used Spring Boot Starters, Classes, Interfaces | by Suresh Kumar | Medium https://medium.com/@sureshkumar_95502/spring-boot-starters-classes-interfaces-part-1-160...

Staff picks Stories to Help You Level-Up


791 stories · 1526 saves at Work
19 stories · 899 saves

Self-Improvement 101 Productivity 101


20 stories · 3165 saves 20 stories · 2674 saves

In Javarevisited by Rahul Soni Saurav Kumar

How to Prevent Duplicate Requests Why You Should Avoid Using


in REST APIs and Why Spring Say… @Autowired in Spring Applications
Handling duplicate requests in a REST API is In the Spring ecosystem, dependency
essential, especially for actions that create,… injection is a key concept that allows for…

Nov 11 192 1 Dec 14 3

13 of 14 12/26/2024, 3:58 PM
Commonly used Spring Boot Starters, Classes, Interfaces | by Suresh Kumar | Medium https://medium.com/@sureshkumar_95502/spring-boot-starters-classes-interfaces-part-1-160...

In Stackademic by Mpavani Harendra

AWS Must Know Concepts for your How I Am Using a Lifetime 100%
certification( All in one) Free Server
Hello all, if you are planning to write AWS Get a server with 24 GB RAM + 4 CPU + 200
certification exam the below cheatsheet… GB Storage + Always Free

Dec 12 19 1 Oct 26 8.1K 125

See more recommendations

Help Status About Careers Press Blog Privacy Terms Text to speech Teams

14 of 14 12/26/2024, 3:58 PM

You might also like