In this blog post, I am going to list commonly used POM.XML dependencies for building RESTful Web services with Spring Boot and Spring MVC.
The list of below dependencies is not complete and will depend on the functionality you need your RESTful Web Services to support. But if you are building a simple REST API then most likely the list of below dependencies will be helpful.
Common Dependencies for Building RESTful Web Services
Use this dependency if your RESTful Web Service needs to respond with XML media type.
<dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-xml</artifactId> </dependency>
A dependency code snippet for working with MySQL Server
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency>
JWT(JSON Web Token) dependency code snippet
<dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt</artifactId> <version>0.9.0</version> </dependency>
Model Mapper dependency to copy properties from one Java bean into another. Used when need to convert Entity bean to DTO object or DTO to Entity bean.
<dependency> <groupId>org.modelmapper</groupId> <artifactId>modelmapper</artifactId> <version>2.0.0</version> </dependency>
Amazon AWS SDK Dependency
<dependency> <groupId>com.amazonaws</groupId> <artifactId>aws-java-sdk-ses</artifactId> </dependency>
JUnit Jupiter Dependency
<dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> <scope>test</scope> </dependency>
H2 In-memory Database Dependency
<dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>runtime</scope> </dependency>
A List of Spring Boot Starters
Below is a short list of Spring Boot Starters which are commonly used in RESTful Web Service applications. A complete list of starters you will find on Spring Boot documentation page.
Spring Boot Parent Starter
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.1.RELEASE</version> <relativePath /> <!-- lookup parent from repository --> </parent>
A Starter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded container:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
Starter for using Spring Data JPA with Hibernate
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency>
A Starter for using Spring Security
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency>
Starter for using Tomcat as the embedded servlet container
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </dependency>
A Starter for building a hypermedia-based RESTful web application with Spring MVC and Spring HATEOAS
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-hateoas</artifactId> </dependency>
A Starter for testing Spring Boot applications with libraries including JUnit, Hamcrest, and Mockito
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency>
A Starter for logging using Logback. Default logging starter
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </dependency>
Starter for using Log4j2 for logging. An alternative to spring-boot-starter-logging
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-log4j2</artifactId> </dependency>
A Starter for using Spring Boot’s Actuator which provides production-ready features to help you monitor and manage your application
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>
A Starter for using Java Bean Validation with Hibernate Validator
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> </dependency>
A Starter for using MongoDB document-oriented database and Spring Data MongoDB
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-mongodb</artifactId> </dependency>
A Starter for using Spring Framework’s caching support
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-cache</artifactId> </dependency>
A Starter for aspect-oriented programming with Spring AOP and AspectJ
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency>