Skip to content

Latest commit

 

History

History
146 lines (114 loc) · 3.99 KB

spring-boot-dependency.md

File metadata and controls

146 lines (114 loc) · 3.99 KB

SpringBoot Dependency

Here are some of the most common dependencies you might come across when working with Spring Boot, along with some interview-style questions, explanations, and code snippets.

1. Spring Web (spring-boot-starter-web)

Question: What is the use of the Spring Web starter dependency?

Answer: It is used to build web applications, including RESTful applications.

Code Snippet:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

2. Spring Data JPA (spring-boot-starter-data-jpa)

Question: What does Spring Data JPA offer?

Answer: Simplifies data access within the Spring application, provides Spring Data repositories, JPA, Hibernate, etc.

Code Snippet:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

3. Spring Security (spring-boot-starter-security)

Question: What functionalities does Spring Security provide?

Answer: Adds authentication and authorization to your application.

Code Snippet:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>

4. Spring Boot Starter Test (spring-boot-starter-test)

Question: How does this dependency help in testing?

Answer: It provides essential libraries for testing Spring components with JUnit, Mockito, etc.

Code Snippet:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>

5. Thymeleaf (spring-boot-starter-thymeleaf)

Question: What is Thymeleaf used for?

Answer: It is a templating engine used for server-side rendering of web pages.

Code Snippet:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

6. Spring Boot Starter Data REST (spring-boot-starter-data-rest)

Question: What is Spring Data REST?

Answer: It simplifies building hypermedia-driven REST web services on top of Spring Data repositories.

Code Snippet:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>

7. Spring Boot Starter Actuator (spring-boot-starter-actuator)

Question: What functionalities does Actuator provide?

Answer: Adds production-ready features like health check-up, metrics gathering, etc.

Code Snippet:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

8. Spring Boot Starter Web Services (spring-boot-starter-web-services)

Question: What is the Spring Boot Starter Web Services dependency used for?

Answer: It is used for building SOAP web services.

Code Snippet:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web-services</artifactId>
</dependency>

9. Spring Boot Starter Data MongoDB (spring-boot-starter-data-mongodb)

Question: What does this dependency offer?

Answer: It provides Spring Data MongoDB which simplifies the development of MongoDB applications.

Code Snippet:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>

10. Spring Boot Starter JDBC (spring-boot-starter-jdbc)

Question: What does this dependency offer?

Answer: It provides basic JDBC connectivity and initializes a DataSource.

Code Snippet:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>

I hope this list helps you in understanding some common Spring Boot dependencies.