Update content files

content/spring-boot
Kamran Ahmed 2 years ago
parent fa9d8d6656
commit fc6e8048a7
  1. 2
      src/roadmaps/angular/content/103-angular-cli/106-schematics.md
  2. 2
      src/roadmaps/angular/content/115-testing-angular-apps/102-testing-component-bindings.md
  3. 2
      src/roadmaps/frontend/content/109-css-preprocessors/index.md
  4. 3
      src/roadmaps/spring-boot/content/100-spring-core/100-introduction/100-terminology.md
  5. 41
      src/roadmaps/spring-boot/content/100-spring-core/100-introduction/101-architecture.md
  6. 30
      src/roadmaps/spring-boot/content/100-spring-core/100-introduction/102-why-spring.md
  7. 13
      src/roadmaps/spring-boot/content/100-spring-core/100-introduction/index.md
  8. 20
      src/roadmaps/spring-boot/content/100-spring-core/102-dependency-injection.md
  9. 2
      src/roadmaps/spring-boot/content/100-spring-core/103-spring-ioc.md
  10. 14
      src/roadmaps/spring-boot/content/100-spring-core/104-spring-aop.md
  11. 14
      src/roadmaps/spring-boot/content/100-spring-core/105-spring-mvc.md
  12. 29
      src/roadmaps/spring-boot/content/100-spring-core/106-annotations.md
  13. 11
      src/roadmaps/spring-boot/content/100-spring-core/107-spring-bean-scope.md
  14. 15
      src/roadmaps/spring-boot/content/100-spring-core/index.md
  15. 12
      src/roadmaps/spring-boot/content/101-spring-security/100-authentication.md
  16. 12
      src/roadmaps/spring-boot/content/101-spring-security/101-authorization.md
  17. 17
      src/roadmaps/spring-boot/content/101-spring-security/102-oauth2.md
  18. 18
      src/roadmaps/spring-boot/content/101-spring-security/103-jwt-authentication.md
  19. 9
      src/roadmaps/spring-boot/content/101-spring-security/index.md
  20. 17
      src/roadmaps/spring-boot/content/102-spring-boot-starters.md
  21. 19
      src/roadmaps/spring-boot/content/103-autconfiguration.md
  22. 6
      src/roadmaps/spring-boot/content/104-spring-boot-actuators.md
  23. 14
      src/roadmaps/spring-boot/content/105-embedded-server.md
  24. 17
      src/roadmaps/spring-boot/content/106-hibernate/100-transactions.md
  25. 8
      src/roadmaps/spring-boot/content/106-hibernate/101-relationships.md
  26. 48
      src/roadmaps/spring-boot/content/106-hibernate/102-entity-lifecycle.md
  27. 2
      src/roadmaps/spring-boot/content/106-hibernate/index.md
  28. 5
      src/roadmaps/spring-boot/content/107-spring-data/100-spring-data-jpa.md
  29. 15
      src/roadmaps/spring-boot/content/107-spring-data/101-spring-data-mongodb.md
  30. 4
      src/roadmaps/spring-boot/content/107-spring-data/102-spring-data-jdbc.md
  31. 4
      src/roadmaps/spring-boot/content/107-spring-data/index.md
  32. 7
      src/roadmaps/spring-boot/content/108-microservices/100-spring-cloud/100-spring-cloud-gateway.md
  33. 8
      src/roadmaps/spring-boot/content/108-microservices/100-spring-cloud/101-cloud-config.md
  34. 9
      src/roadmaps/spring-boot/content/108-microservices/100-spring-cloud/102-spring-cloud-circuit-breaker.md
  35. 8
      src/roadmaps/spring-boot/content/108-microservices/100-spring-cloud/103-spring-cloud-openfeign.md
  36. 8
      src/roadmaps/spring-boot/content/108-microservices/100-spring-cloud/104-hystrix.md
  37. 4
      src/roadmaps/spring-boot/content/108-microservices/100-spring-cloud/105-sleuth.md
  38. 8
      src/roadmaps/spring-boot/content/108-microservices/100-spring-cloud/106-eureka.md
  39. 4
      src/roadmaps/spring-boot/content/108-microservices/index.md
  40. 2
      src/roadmaps/spring-boot/content/109-spring-mvc/100-servlet.md
  41. 8
      src/roadmaps/spring-boot/content/109-spring-mvc/101-jsp-files.md
  42. 16
      src/roadmaps/spring-boot/content/109-spring-mvc/102-architecture.md
  43. 20
      src/roadmaps/spring-boot/content/109-spring-mvc/103-components.md
  44. 14
      src/roadmaps/spring-boot/content/109-spring-mvc/index.md
  45. 4
      src/roadmaps/spring-boot/content/110-testing/100-jpa-test.md
  46. 12
      src/roadmaps/spring-boot/content/110-testing/101-mock-mvc.md
  47. 22
      src/roadmaps/spring-boot/content/110-testing/102-spring-boot-test-annotation.md
  48. 19
      src/roadmaps/spring-boot/content/110-testing/103-mockbean-annotation.md
  49. 23
      src/roadmaps/spring-boot/content/110-testing/index.md

@ -4,5 +4,5 @@ A schematic is a template-based code generator that supports complex logic. It i
Visit the following resources to learn more:
- [Angular Website](https://angular.io/guide/schematics#:~:text=A%20schematic%20is%20a%20template,collections%20and%20installed%20with%20npm.)
- [Angular Website](https://angular.io/guide/schematics)
- [Angular Blog](https://blog.angular.io/schematics-an-introduction-dc1dfbc2a2b2?gi=ad9571373944)

@ -4,4 +4,4 @@ Angular processes all data bindings once for each JavaScript event cycle, from t
Visit the following resources to learn more:
- [Angular.io Website](https://angular.io/guide/architecture-components#:~:text=Angular%20processes%20all%20data%20bindings,between%20parent%20and%20child%20components.)
- [Angular.io Website](https://angular.io/guide/architecture-components)

@ -4,5 +4,5 @@ CSS Preprocessors are scripting languages that extend the default capabilities o
Visit the following resources to learn more:
- [CSS Preprocessors Explained](https://www.freecodecamp.org/news/css-preprocessors/#:~:text=CSS%20Preprocessors%20compile%20the%20code,preprocessor%20were%20not%20in%20place.)
- [CSS Preprocessors Explained](https://www.freecodecamp.org/news/css-preprocessors/)
- [Why Use Preprocessors?](https://sherocommerce.com/what-is-a-css-preprocessors-why-use-them/)

@ -15,5 +15,4 @@ Here are a few key terms and concepts that are commonly used when working with S
For more information visit the following links:
- [Spring Boot - Introduction](https://www.tutorialspoint.com/spring_boot/spring_boot_introduction.htm)
- [Spring Boot Tutorial](https://www.digitalocean.com/community/tutorials/spring-boot-tutorial)
- [Guide to Spring Boot](https://www.educative.io/courses/guide-spring-5-spring-boot-2/3jjq3L6VW0n)
- [Spring Boot Tutorial](https://www.digitalocean.com/community/tutorials/spring-boot-tutorial)

@ -1,43 +1,14 @@
# Architecture
Spring Boot is a module of the Spring Framework. It is used to create stand-alone, production-grade Spring Based Applications with minimum efforts. It is developed on top of the core Spring Framework.
Spring Boot follows a layered architecture in which each layer communicates with the layer directly below or above (hierarchical structure) it.
Before understanding the Spring Boot Architecture, we must know the different layers and classes present in it. There are four layers in Spring Boot are as follows:
- Presentation Layer
- Business Layer
- Persistence Layer
- Database Layer
**Presentation Layer**: The presentation layer handles the HTTP requests, translates the JSON parameter to object, and authenticates the request and transfer it to the business layer. In short, it consists of views i.e., frontend part.
**Business Layer**: The business layer handles all the business logic. It consists of service classes and uses services provided by data access layers. It also performs authorization and validation.
**Persistence Layer**: The persistence layer contains all the storage logic and translates business objects from and to database rows.
**Database Layer**: In the database layer, CRUD (create, retrieve, update, delete) operations are performed.
Spring Boot Flow Architecture
- Now we have validator classes, view classes, and utility classes.
- Spring Boot uses all the modules of Spring-like Spring MVC, Spring Data, etc. The architecture of Spring Boot is the same as the architecture of Spring MVC, except one thing: there is no need for DAO and DAOImpl classes in Spring boot.
- Creates a data access layer and performs CRUD operation.
- The client makes the HTTP requests (PUT or GET).
- The request goes to the controller, and the controller maps that request and handles it. After that, it calls the service logic if required.
- In the service layer, all the business logic performs. It performs the logic on the data that is mapped to JPA with model classes.
- A JSP page is returned to the user if no error occurred.
Spring Boot follows a layered architecture in which each layer communicates with the layer directly below or above (hierarchical structure) it. There are four layers in Spring Boot are as follows:
- **Presentation Layer**: handles the HTTP requests, translates the JSON parameter to object, and authenticates the request and transfer it to the business layer.
- **Business Layer**: The business layer handles all the business logic. It consists of service classes and uses services provided by data access layers. It also performs authorization and validation.
- **Persistence Layer**: The persistence layer contains all the storage logic and translates business objects from and to database rows.
- **Database Layer**: In the database layer, CRUD (create, retrieve, update, delete) operations are performed.
For more information, visit the following links:
- [Spring Boot Architecture](https://www.javatpoint.com/spring-boot-architecture)
- [Spring Boot Architecture – Detailed Explanation](https://www.interviewbit.com/blog/spring-boot-architecture#:~:text=Spring%20Boot%20uses%20a%20hierarchical,above%20it%20(%20hierarchical%20structure).)
- [Spring Boot Architecture – Detailed Explanation](https://www.interviewbit.com/blog/spring-boot-architecture)
- [Spring Boot – Architecture](https://www.geeksforgeeks.org/spring-boot-architecture/)

@ -1,28 +1,18 @@
# Why spring
# Why Spring
Spring Boot is a framework for building web applications and microservices using the Spring Framework. It provides a number of features that make it easier to create a Spring-based application, including:
Spring Boot provides a number of features that make it easier to create a Spring-based application, including:
- Embedding Tomcat, Jetty, or Undertow directly in the application, so that you don't have to deploy the application to a separate application server.
- Automatically configuring Spring based on the classpath and other settings, so that you don't have to manually configure Spring yourself.
- Providing a number of pre-configured "starters" that you can include in your application to quickly and easily add functionality to your application. For example, the "spring-boot-starter-web" starter includes everything you need to create a web application, including Spring MVC, embedded Tomcat, and a number of other useful libraries.
- Providing a number of features to help you package and distribute your application, such as an executable jar file and the ability to run the application as a service on Linux and Windows.
- Providing a number of features to help you monitor and manage your application, such as a built-in health check endpoint and the ability to customize the management endpoint.
Because Spring Boot provides all these features in a easy to use and opinionated way, it allows developers to bootstrap and standup new spring based web application and services quickly and effectively. Additionally, it's come with a lot of best practices and conventions baked in, which reduces the amount of work and boiler plate code developers need to write.
- Embedded Application Server
- Automatic Configuration
- Pre-configured Starters
- Ease of Packaging and Distribution
- Ease of monitoring through built-in health check endpoint and the ability to customize the management endpoint.
Additionally, it's come with a lot of best practices and conventions baked in, which reduces the amount of work and boiler plate code developers need to write.
Visit the following resources to learn more:
- [Why Spring?](https://spring.io/why-spring#:~:text=Spring%20Boot%20helps%20developers%20build,iterate%20faster%20than%20ever%20before.)
- [Spring vs Spring Boot: Know The Difference](https://www.interviewbit.com/blog/spring-vs-spring-boot/#:~:text=or%20Spring%20Boot%3F-,Spring%20Boot%20contains%20all%20of%20the%20functionality%20of%20the%20standard,the%20answer%20is%20Spring%20Boot.)
- [Why Spring?](https://spring.io/why-spring)
- [Spring vs Spring Boot: Know The Difference](https://www.interviewbit.com/blog/spring-vs-spring-boot)
- [A Comparison Between Spring and Spring Boot](https://www.baeldung.com/spring-vs-spring-boot)
- [Advantages of Spring Boot](https://www.adservio.fr/post/advantages-of-spring-boot)

@ -2,20 +2,9 @@
Spring Boot is a framework for building applications based on the Spring Framework, a widely-used, open-source framework for building Java-based enterprise applications. Spring Boot aims to make it easy to create stand-alone, production-grade Spring-based applications that you can "just run".
One of the main benefits of using Spring Boot is that it reduces the amount of configuration required to set up and run a Spring application. It provides a lot of sensible defaults that can be overridden as needed, and it also provides a simple way to package and distribute your application.
Spring Boot also provides a number of features that can be used out-of-the-box to quickly build and deploy web applications, including:
- Embedded servlet containers (such as Tomcat and Jetty) to run the application
- Support for common development and testing tools, like H2 and Flyway
- Automatic configuration of Spring features, like data access and security
- Spring Boot applications can be built using either Maven or Gradle build tools. It also supports a variety of embedded web servers and also can be easily deployed to cloud platforms like AWS, Heroku, and many others.
Spring Boot is a great option for building Java-based microservices, and is also well-suited to building the backend of web and mobile applications.
For more information, visit the following links:
- [Spring Boot - Introduction](https://www.tutorialspoint.com/spring_boot/spring_boot_introduction.htm)
- [Introduction to Spring Boot](https://medium.com/adessoturkey/introduction-to-spring-boot-458cb814ec14)
- [Spring Boot](https://spring.io/projects/spring-boot)
- [What-is-Spring-Boot?](https://www.ibm.com/topics/java-spring-boot#:~:text=Java%20Spring%20Boot%20(Spring%20Boot,ability%20to%20create%20standalone%20applications)
- [What-is-Spring-Boot?](https://www.ibm.com/topics/java-spring-boot)

@ -1,26 +1,10 @@
# Dependency injection
Dependency injection is a technique where an object supplies the dependencies of another object. In Spring Boot, dependency injection is used to manage the objects that make up an application, and to provide those objects with the dependencies they need to function properly.
# Dependency Injection
Spring Boot uses the Spring Framework's Inversion of Control (IoC) container to manage objects and their dependencies. The IoC container is responsible for creating objects, wiring them together, and managing their lifecycle. When an object is created, its dependencies are also created and injected into the object.
There are several ways to perform dependency injection in Spring Boot:
1. Using the **@Autowired** annotation: This annotation is used to mark a constructor, field, or setter method as something that should be automatically wired by Spring.
2. Using the **@Inject** annotation : This is an alternative for @Autowired, javax.inject.Inject is a standard annotation for dependency injection and Spring supports it too.
3. Using XML configuration: You can use XML files to define the dependencies that should be injected into your objects.
4. Using Java configuration: Instead of using XML files, you can use Java configuration classes to define the dependencies that should be injected.
Regardless of the approach you use, the core idea behind dependency injection in Spring Boot is to separate the concerns of an application and to make it easy to change or replace the dependencies of an object without affecting the rest of the application.
You can learn more about dependency injection in Spring Boot by reading the documentation and following some tutorials available online.
Visit the following links for more resources:
- [Spring Dependency Injection](https://www.baeldung.com/spring-dependency-injection#:~:text=Dependency%20Injection%20is%20a%20fundamental,managing%20components%20onto%20the%20container.)
- [Spring Dependency Injection](https://www.baeldung.com/spring-dependency-injection)
- [Dependency Injection Using Spring Boot](https://medium.com/edureka/what-is-dependency-injection-5006b53af782)
- [Dependency Injection in Spring](https://www.javatpoint.com/dependency-injection-in-spring)

@ -1,4 +1,4 @@
# Spring ioc
# Spring IOC
Inversion of Control (IoC) is a design pattern that is often used in conjunction with the Dependency Injection (DI) pattern. The basic idea behind IoC is to invert the flow of control in a program, so that instead of the program controlling the flow of logic and the creation of objects, the objects themselves control the flow of logic and the creation of other objects.

@ -1,22 +1,12 @@
# Spring aop
# Spring AOP
Spring AOP (Aspect-Oriented Programming) is a feature of the Spring Framework that allows developers to define certain behaviors (i.e., "aspects") that cut across multiple classes, such as logging or transaction management. These behaviors, which are called "advices," can be applied to specific "join points" (i.e., points in the execution of a program) in the application, using "pointcuts" to determine where the advices should be applied.
Spring AOP allows developers to separate the implementation of these cross-cutting concerns from the business logic of the application, making the code more modular and easier to understand. This can also make the application more flexible, since the same advices can be applied to different parts of the code without having to duplicate the code for the advices themselves.
It uses AspectJ for pointcuts, advices and weaving . Spring AOP can be use for both proxy-based AOP and AspectJ based AOP. Proxies are generated at runtime while aspectJ weaving is done at compile time.
There are 3 types of advices:
1. Before advice: Run before the method execution
2. After returning advice: Run after the method execution, if method completes successfully
3. After throwing advice: Run after the method execution, if method exits by throwing an exception.
To use AOP in spring application you will have to add the spring-aop module to your application and configure it using XML or Java Configuration.
For more resources, visit the following links:
- [Spring AOP Tutorial](https://www.simplilearn.com/tutorials/spring-tutorial/spring-aop-aspect-oriented-programming#:~:text=Aspect%2DOriented%20Programming%20(AOP),into%20separate%20parts%20called%20concerns.)
- [Spring AOP Tutorial](https://www.simplilearn.com/tutorials/spring-tutorial/spring-aop-aspect-oriented-programming)
- [AOP with Spring Framework](https://www.tutorialspoint.com/spring/aop_with_spring.htm)
- [Spring AOP Tutorial](https://howtodoinjava.com/spring-aop-tutorial/)

@ -1,21 +1,11 @@
# Spring mvc
# Spring MVC
Spring MVC is a framework for building web applications in Java. It is part of the Spring Framework, which is a larger ecosystem of tools for building Java applications. Spring MVC is built on the Model-View-Controller (MVC) design pattern, which helps to separate the concerns of the application into three distinct components: the Model, the View, and the Controller.
The Model represents the data and business logic of the application. It is typically implemented as a set of Java objects that encapsulate the data and behavior of the application.
The View is responsible for displaying the data to the user. In Spring MVC, views are typically implemented as JSPs (JavaServer Pages) or Thymeleaf templates, but other view technologies can also be used.
The Controller handles incoming requests from the user and directs them to the appropriate Model and View. In Spring MVC, controllers are typically implemented as Java classes that are annotated with the @Controller annotation.
Spring MVC provides a powerful and flexible way to build web applications, and it integrates well with other parts of the Spring ecosystem, such as Spring Security for authentication and authorization, and Spring Data for data access.
The Spring Framework is able to handle the request/response flow with servlet and handlers, that's why it is known as "Spring Web MVC" or just "Spring MVC".
For more resources, visit the following links:
- [Spring MVC Tutorial](https://www.javatpoint.com/spring-mvc-tutorial)
- [Spring - MVC Framework](https://www.tutorialspoint.com/spring/spring_web_mvc_framework.htm)
- [Web MVC framework](https://docs.spring.io/spring-framework/docs/3.2.x/spring-framework-reference/html/mvc.html)
- [Web MVC framework](https://docs.spring.io/spring-framework/docs/3.2.x/spring-framework-reference/html/mvc.html)

@ -1,29 +1,20 @@
# Annotations
Spring Boot is a Java-based framework for building web applications and microservices. It is built on top of the Spring Framework, and aims to make it easier to create stand-alone, production-grade Spring-based applications. One of the key features of Spring Boot is its use of annotations, which are used to configure various aspects of the application and to enable certain features.
One of the key features of Spring Boot is its use of annotations, which are used to configure various aspects of the application and to enable certain features.
Some of the most commonly used annotations in Spring Boot include:
- **@SpringBootApplication**: This is a convenience annotation that is used to enable several key features of Spring Boot, including auto-configuration, component scanning, and the ability to run the application as a standalone Java program.
- **@RestController**: This annotation is used to create a web service endpoint in a Spring Boot application. It is a combination of the @Controller and @ResponseBody annotations from the Spring MVC framework, and is used to create RESTful web services.
- **@Autowired**: This annotation is used to automatically inject dependencies into a Spring-managed bean. It can be used on fields, constructors, or setter methods to indicate that the corresponding dependency should be injected at runtime.
- **@Value**: This annotation is used to inject a property value from a application.properties or application.yml file into a field. This allows you to externalize configuration from your code, making it easier to change settings in different environments.
- **@Enable**: Spring Boot provides several annotations that can be used to enable certain features, such as @EnableJpaRepositories, @EnableScheduling, @EnableAsync, etc.
- **@Configuration** : Annotating a class with @Configuration indicates that the class can be used by the Spring IoC container as a source of bean definitions.
- **@Bean** : Annotating a method with @Bean tells Spring that the return value of that method should be registered as a bean in the Spring application context.
- `@SpringBootApplication`
- `@RestController`
- `@Autowired`
- `@Value`
- `@Enable`
- `@Configuration`
- `@Bean`
-
These are just a few examples of the many annotations that are available in Spring Boot. There are many other annotations that you can use to configure various aspects of your application, such as security, caching, and data access.
Keep in mind, Spring Boot Annotation are extensive, you can use them to configure and customize the behavior of your application to a great extent. With the help of annotations, you can build powerful and flexible applications with minimal amount of code.
Visit the following link for more resouces on annotations in spring boot:
Visit the following link for more details on annotations in spring boot:
- [Spring Annotations](https://www.digitalocean.com/community/tutorials/spring-annotations)
- [Spring Boot Annotations](https://www.javatpoint.com/spring-boot-annotations)

@ -1,11 +1,10 @@
# Spring bean scope
# Spring Bean Scope
In the Spring Framework, a bean is an object that is instantiated, assembled, and managed by the Spring IoC container. One of the key features of the Spring container is its ability to manage the lifecycle of beans, which includes creating, configuring, and destroying beans as necessary. One way the container can control the lifecycle of a bean is by specifying its scope.
The scope of a bean determines the lifecycle and visibility of the bean within the container and to other objects in the application. Spring provides several different bean scopes, including:
singleton: This is the default scope for a bean. A singleton bean is instantiated only once by the container and shared by all objects that request it.
- **singleton**: This is the default scope for a bean. A singleton bean is instantiated only once by the container and shared by all objects that request it.
- **prototype**: This scope means that the container creates a new instance of the bean every time a request is made for it.
- **request**: This scope is only applicable to web applications and means that the container creates a new instance of the bean for each HTTP request.
- **session**: Similar to the request scope, but the instance of the bean is created for each HTTP session,
@ -16,12 +15,8 @@ The scope of a bean can be specified in the configuration file using the scope a
It is very important to choose the right scope for a bean, as it can affect the behavior and performance of the application.
Visit the following links for more resources:
- [Spring - Bean Scopes](https://www.tutorialspoint.com/spring/spring_bean_scopes.htm)
- [Quick Guide to Spring Bean Scopes](https://www.baeldung.com/spring-bean-scopes)
- [Spring Bean Scopes](https://www.digitalocean.com/community/tutorials/spring-bean-scopes)
- [Spring Bean Scopes](https://www.digitalocean.com/community/tutorials/spring-bean-scopes)

@ -1,24 +1,11 @@
# Spring Core
Spring is an open-source framework that provides a comprehensive programming and configuration model for modern Java-based enterprise applications. The core module of Spring, also known as the "Spring Core" module, is at the heart of the framework and provides the fundamental functionality for dependency injection (DI) and inversion of control (IoC).
Dependency injection, also known as inversion of control (IoC), is a design pattern in which objects are given their dependencies, instead of creating or looking for dependent objects themselves. This allows for a decoupling of objects from their dependencies, making the code more flexible and easier to maintain.
The Spring Core module provides several key components for dependency injection, such as:
- The BeanFactory, which is an implementation of the factory pattern that provides a mechanism for creating and managing objects, known as "beans".
- The ApplicationContext, which is an extension of the BeanFactory and provides additional functionality, such as support for internationalization (i18n) and event-propagation.
In addition to dependency injection, the Spring Core module also provides several other features, such as:
Spring is an open-source framework that provides a comprehensive programming and configuration model for modern Java-based enterprise applications. The core module of Spring, also known as the "Spring Core" module, is at the heart of the framework and provides the fundamental functionality for dependency injection (DI) and inversion of control (IoC). In addition to dependency injection, the Spring Core module also provides several other features, such as:
- A flexible and extensible validation framework
- A type conversion system
- A consistent messaging framework
Overall, the Spring Core module provides the foundational functionality for building Java-based enterprise applications with Spring, and is widely used in many different types of applications, such as web applications, enterprise JavaBeans (EJBs), and JavaServer Faces (JSF) applications.
Note that Spring Framework has a lot more modules to it such as Spring MVC, Spring Security, Spring Boot etc. All the features of Spring are not limited to just Spring Core.
You can learn more about Spring Core from the links below:
- [Official website](https://spring.io/)

@ -2,18 +2,6 @@
Spring Security is a framework for securing Java-based applications. One of its core features is authentication, which is the process of verifying that a user is who they claim to be. Spring Security provides a wide range of options for implementing authentication, including support for traditional username/password-based authentication as well as more modern alternatives such as OAuth and JSON Web Tokens (JWT).
The Spring Security framework uses a chain of **AuthenticationProviders** to authenticate a user. An **AuthenticationProvider** is responsible for verifying the credentials of a user and returning an **Authentication** object if the user is authenticated successfully. The **Authentication** object contains information about the user, such as their name, roles, and any additional details that are required by your application.
A typical implementation of an **AuthenticationProvider** would involve checking the user credentials against a database or an external service. You can implement your own custom **AuthenticationProvider** by creating a class that implements the **AuthenticationProvider** interface and overrides the authenticate method.
In the authenticate method, you'll need to retrieve the user's credentials from the Authentication object passed to the method and check them against your user store. If the credentials are valid, you'll create a new Authentication object and return it. If the credentials are invalid, you'll throw an **AuthenticationException**.
You can also use the built-in authentication provider classes provided by Spring Security, such as **DaoAuthenticationProvider** and **LdapAuthenticationProvider**, to authenticate users against a database or LDAP server respectively.
Besides the authentication part, Spring Security also provide authorization functionality, meaning it will check if the authenticated user is authorized to access certain functionality or endpoints.
In summary, Spring Security provides a powerful and flexible framework for implementing authentication in Java-based applications. It allows you to authenticate users against various types of authentication stores and provides a wide range of options for customizing the authentication process to meet the needs of your specific application.
For more info, visit the following resources:
- [Spring Authentication](https://docs.spring.io/spring-security/reference/features/authentication/index.html)

@ -1,16 +1,6 @@
# Authorization
Spring Security is a framework for securing Java-based applications. It provides a comprehensive security solution for both web-based and non-web-based applications. One of the key features of Spring Security is its ability to handle authentication and authorization for your application.
Authentication is the process of verifying the identity of a user, while authorization is the process of determining whether a user has access to certain resources or functionality within an application.
Spring Security supports a variety of authentication mechanisms, such as username and password authentication, OAuth2, and more. Once a user is authenticated, Spring Security can then be used to authorize that user's access to specific resources or functionality.
To set up authorization in Spring Security, you can use annotations such as @Secured or @PreAuthorize to control access to specific methods or classes. For example, you might use the @PreAuthorize annotation to restrict access to a method to only users with a certain role, like so:
Additionally, you can use the "intercept-url" element in Spring Security's XML configuration or WebSecurityConfigurerAdapter's .authorizeRequests() method in Java Config to configure the URLs to which authorization checks should be applied, and use spring EL (Expression Language) to control access.
Overall, Spring Security provides a lot of flexibility in terms of how you can handle authentication and authorization in your application, and it's a powerful tool for securing your application.
Spring Security supports a variety of authentication mechanisms, such as username and password authentication, OAuth2, and more. Once a user is authenticated, Spring Security can then be used to authorize that user's access to specific resources or functionality. There are several annotations that can be used to control access to specific methods or classes.
Visit the following links for more information:

@ -1,20 +1,9 @@
# Oauth2
OAuth2 is an open standard for authorization that allows users to share their private resources (such as an API, a website, or a service) with third-party applications, without having to reveal their login credentials. It works by allowing users to authorize third-party applications to access their resources, without having to share their passwords.
In Spring, OAuth2 is implemented as a set of libraries, which can be integrated into your application to provide authentication and authorization functionality. The core library provides the OAuth2 protocol functionality, while additional libraries can be added to support different types of clients (such as web apps, mobile apps, or single-page apps), token stores, and user details services.
One of the most common ways to implement OAuth2 in Spring is by using the Spring Security OAuth2 library, which provides support for both the authorization code grant type (for web apps) and the implicit grant type (for single-page apps). You can also use Spring Security to protect your resources, and to configure your application as an OAuth2 resource server.
The OAuth2 authentication process can be complex and time-consuming, but the Spring Security OAuth2 library makes it easy to get started by providing a set of convenient configuration classes and annotations.
You should also be aware that Spring Security OAuth 2 is in maintenance mode , the development of new features or fixes is discontinued and you would need to use Spring Security 5.5.x or Spring Security 6.0.x to get new features and also Spring Boot 2.3.x or Spring Boot 2.4.x is recommended, otherwise you may face issues with compatibility.
It's important to read the documentation to understand how it works and what the best configuration options for your use case.
# OAuth2
Spring Security OAuth2 library provides support for both the authorization code grant type (for web apps) and the implicit grant type (for single-page apps). You can also use Spring Security to protect your resources, and to configure your application as an OAuth2 resource server. The OAuth2 authentication process can be complex and time-consuming, but the Spring Security OAuth2 library makes it easy to get started by providing a set of convenient configuration classes and annotations.
Learn more about Oauth2 from the following resources:
- [Spring Boot - OAuth2 with JWT](https://www.tutorialspoint.com/spring_boot/spring_boot_oauth2_with_jwt.htm#:~:text=OAuth2%20is%20an%20authorization%20framework,Client%20ID%20and%20Client%20secret.)
- [Spring Boot - OAuth2 with JWT](https://www.tutorialspoint.com/spring_boot/spring_boot_oauth2_with_jwt.htm)
- [Spring Boot and OAuth2](https://spring.io/guides/tutorials/spring-boot-oauth2/)
- [Spring Security](https://www.tutorialspoint.com/spring_security/spring_security_with_oauth2.htm)

@ -1,19 +1,9 @@
# Jwt authentication
# JWT Authentication
JSON Web Token (JWT) is a JSON-based open standard for creating access tokens that assert some number of claims. These claims can be verified and trusted because they are digitally signed. JWT is typically used to protect API endpoints, and it enables the transmission of information that can be verified and trusted, because it is digitally signed.
In a Spring application, you can use the Spring Security library to add JWT authentication and authorization to your API. The library provides a JWT-based authentication filter that you can add to your API endpoints. The filter will check the JWT that is included in the request header, and if it is valid, it will set the authentication information in the security context. You can then use the security context to perform authorization checks on the API endpoints.
To use JWT in Spring, you'll need to first configure Spring Security to use JWT. You'll need to add the Spring Security and JJWT (Java JWT) dependencies to your project, and then configure the JWT filter and the authentication manager.
Once the configuration is done, you will need to add the filter in your Security Configuration class with httpSecurity.addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class);
You will also need to create a service to create and validate JWT tokens, and then use it in your authentication controller. There are various library available for this like JWT Java library, Spring Security JWT.
Spring Security can be used to implement JWT Authentication and Authorization to your APIs. The library provides a JWT-based authentication filter that you can add to your API endpoints. The filter will check the JWT that is included in the request header, and if it is valid, it will set the authentication information in the security context. You can then use the security context to perform authorization checks on the API endpoints.
For more resources, visit the following links:
- [JWT Token Authentication in Spring](https://springframework.guru/jwt-authentication-in-spring-microservices-jwt-token/#:~:text=Spring%20Boot%20Microservices%20requires%20authentication,securely%20transmitting%20information%20between%20parties.)
- [JWT Token Authentication in Spring](https://springframework.guru/jwt-authentication-in-spring-microservices-jwt-token/)
- [Spring Security with JWT for REST API](https://www.toptal.com/spring/spring-security-tutorial)
- [Spring Security - JWT](https://www.tutorialspoint.com/spring_security/spring_security_with_jwt.htm)
- [Spring Security - JWT](https://www.tutorialspoint.com/spring_security/spring_security_with_jwt.htm)

@ -2,15 +2,6 @@
Spring Security is a framework for securing Java-based applications. It is a powerful and highly customizable authentication and access-control framework that can be easily integrated with a wide variety of applications, including web applications and RESTful web services. Spring Security provides a comprehensive security solution for both authentication and authorization, and it can be used to secure applications at both the web and method level.
One of the key features of Spring Security is its ability to authenticate users based on a variety of credentials, including username and password, as well as more advanced options like OAuth and JSON Web Tokens (JWT). It also provides support for a wide range of authentication mechanisms, including form-based authentication, basic authentication, and authentication using X.509 certificates.
Another important feature of Spring Security is its support for authorization. This means that it can be used to control access to various parts of an application based on the roles and permissions of the authenticated user. Spring Security provides a flexible and powerful authorization model that can be easily customized to suit the needs of the application.
It also integrates well with Spring ecosystem, like Spring Boot, making it easier to setup and configure security on an application.
It provides a lot of useful feature that helps in securing the application by providing role based access, security on RESTful services and much more.
Visit the following links for more resources:
- [Spring Security](https://spring.io/projects/spring-security)

@ -1,22 +1,9 @@
# Spring boot starters
# Spring Boot Starters
Spring Boot starters are a set of convenient dependency descriptors that you can include in your application. They provide a variety of functionality, such as security, data access, and web services, and help to minimize the amount of boilerplate code and configuration you need to write.
Each starter POM (pom.xml) contains a list of dependencies and configurations that are known to work together. For example, the spring-boot-starter-web is a starter for building web, including RESTful, applications using Spring MVC. It includes the spring-webmvc and spring-web modules, as well as a number of other modules required for a typical web application.
When you add a starter to your application's build, the necessary dependencies and configurations are automatically added, and you can start using the provided functionality right away.
Here are a few examples of popular starters:
- spring-boot-starter-web: For building web applications and RESTful services.
- spring-boot-starter-data-jpa: For building Spring Data JPA based repositories and data access layer.
- spring-boot-starter-security: For adding Spring Security to your application.
- spring-boot-starter-test: For adding test dependencies and libraries such as JUnit, AssertJ and Hamcrest, for writing unit and integration tests.
There are more than 20+ starters available for various use-cases, with more being added as new features are introduced in Spring Boot. Using starters can make it easier to add functionality to your application and it gives you a set of well-known and well-tested dependencies, configuration, and defaults to help you get started quickly.
For more information, visit the following links:
- [Intro to Spring Boot Starters](https://www.baeldung.com/spring-boot-starters)
- [Spring Boot Starters](https://www.javatpoint.com/spring-boot-starters)
- [Starters in Spring Boot](https://www.geeksforgeeks.org/spring-boot-starters/)
- [Starters in Spring Boot](https://www.geeksforgeeks.org/spring-boot-starters/)

@ -1,22 +1,9 @@
# Autconfiguration
Spring Autoconfiguration is a feature of Spring Boot that automatically configures beans and other components based on the presence of certain classes and properties on the classpath. This makes it easy to add functionality to your application without having to write a lot of boilerplate configuration code.
When you include a dependency in your application, Spring Boot will automatically look for a corresponding "auto-configuration" class that can configure the necessary beans and other components. For example, if you include the spring-boot-starter-web dependency in your application, Spring Boot will automatically configure a DispatcherServlet and other components necessary for building web applications.
Auto-configurations can be fine-tuned by providing specific properties in the application.properties, application.yml or other configuration files. Spring Boot uses these properties to adjust its behavior and configure beans accordingly.
For example, if you want to change the default data source for your application, you can include the properties for a different data source and Spring Boot will automatically configure a DataSource bean for it.
Spring Boot also provides a set of annotations such as @EnableAutoConfiguration that can be used to enable or disable specific auto-configurations, such as @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) would disable the auto-configuration for the data-source.
In summary, Spring Boot's Autoconfiguration is a powerful and convenient feature that makes it easy to configure beans and other components in your application based on the presence of certain dependencies and properties. It saves developer's time by reducing the need for boilerplate configuration code, and can be fine-tuned through properties and annotations, to provide a fine-grained control over the auto-configurations.
Spring Boot's Autoconfiguration is a powerful and convenient feature that makes it easy to configure beans and other components in your application based on the presence of certain dependencies and properties. It saves developer's time by reducing the need for boilerplate configuration code, and can be fine-tuned through properties and annotations, to provide a fine-grained control over the auto-configurations.
For more information, visit the following links:
- [Auto-configuration using Spring Boot](https://docs.spring.io/spring-boot/docs/2.0.x/reference/html/using-boot-auto-configuration.html#:~:text=Spring%20Boot%20auto%2Dconfiguration%20attempts,configures%20an%20in%2Dmemory%20database.)
- [Auto-configuration using Spring Boot](https://docs.spring.io/spring-boot/docs/2.0.x/reference/html/using-boot-auto-configuration.html)
- [Spring Boot Auto-configuration](https://www.javatpoint.com/spring-boot-auto-configuration)
- [What is Spring Boot Auto-configuration](https://www.geeksforgeeks.org/spring-boot-auto-configuration/)
- [What is Spring Boot Auto-configuration](https://www.geeksforgeeks.org/spring-boot-auto-configuration/)

@ -1,4 +1,4 @@
# Spring boot actuators
# Actuators
Spring Boot Actuators are a set of production-ready features in Spring Boot that allow you to monitor and manage your application in various ways. They provide a variety of endpoints that expose information about the health and performance of your application, and allow you to perform various management tasks such as shutting down the application or refreshing its configuration.
@ -12,10 +12,8 @@ Some of the key features of Spring Boot Actuators include:
Spring Boot Actuators are typically used in production environments to monitor the health and performance of an application and identify any issues that may arise. They can also be used in development and testing environments to gain insight into the internal workings of the application.
Actuators can be easily added to a Spring Boot application by including the spring-boot-starter-actuator dependency in your project and they can be accessed by default on a special /actuator path in your application. With Actuators you can monitor the health of your application and gain insight on how it behaves, also it can be used to perform various management tasks on your application.
For more information, visit the following links:
- [Building a RESTful Web Service with Spring Boot Actuator](https://spring.io/guides/gs/actuator-service/#:~:text=Spring%20Boot%20Actuator%20is%20a,how%20to%20add%20these%20services.)
- [Building a RESTful Web Service with Spring Boot Actuator](https://spring.io/guides/gs/actuator-service/)
- [Spring Boot Starter Actuator](https://www.javatpoint.com/spring-boot-actuator)
- [What is Spring Boot Actuator](https://www.baeldung.com/spring-boot-actuators)

@ -1,17 +1,9 @@
# Embedded server
# Embedded Server
Spring Embedded Server refers to the ability of Spring Boot applications to run an embedded web server, such as Tomcat, Jetty or Undertow, directly within the application, without the need to deploy it to a separate standalone web server. This makes it easy to develop and test web applications, as well as to deploy them in environments where a standalone web server may not be available or desirable.
When you include the spring-boot-starter-web dependency in your application, Spring Boot automatically configures and starts an embedded web server, such as Tomcat, to run your application. This means that you don't need to install and configure a separate web server, such as Apache Tomcat, to run your application.
Embedded servers are also lightweight and easy to start and stop, which makes it easier to test your application. You can start and stop the embedded server programmatically and run integration tests on your controllers, endpoints and other web components.
You can also configure the port and other options of the embedded server by specifying properties in the application.properties or application.yml file.
In summary, Spring Boot's Embedded Server feature is a convenient and powerful feature that allows you to run a web server directly within your application, without the need to deploy it to a separate standalone web server. This makes it easy to develop, test, and deploy web applications, and it's also lightweight, easy to start and stop, and easy to configure.
Spring Boot's Embedded Server feature is a convenient and powerful feature that allows you to run a web server directly within your application, without the need to deploy it to a separate standalone web server. This makes it easy to develop, test, and deploy web applications, and it's also lightweight, easy to start and stop, and easy to configure.
For more resources, visit the following links:
- [Embedded Servers in Spring](https://subscription.packtpub.com/book/application-development/9781789132588/3/ch03lvl1sec24/embedded-servers#:~:text=Spring%20Boot%20brings%20in%20the,is%20installed%20on%20the%20server.)
- [Embedded Servers in Spring](https://subscription.packtpub.com/book/application-development/9781789132588/3/ch03lvl1sec24/embedded-servers)
- [What is an Embedded Server? (Spring Boot)](https://www.springboottutorial.com/java-programmer-essentials-what-is-an-embedded-server)
- [Embedded Web Servers ‘How-to’ guides](https://docs.spring.io/spring-boot/docs/2.1.9.RELEASE/reference/html/howto-embedded-web-servers.html)

@ -2,26 +2,11 @@
A transaction simply represents a unit of work. In such case, if one step fails, the whole transaction fails (which is termed as atomicity). A transaction can be described by ACID properties (Atomicity, Consistency, Isolation and Durability).
Transaction Interface in Hibernate
In hibernate framework, we have Transaction interface that defines the unit of work. It maintains abstraction from the transaction implementation (JTA,JDBC).
A transaction is associated with Session and instantiated by calling session.beginTransaction().
The methods of Transaction interface are as follows:
1. void begin() starts a new transaction.
2. void commit() ends the unit of work unless we are in FlushMode.NEVER.
3. void rollback() forces this transaction to rollback.
4. void setTimeout(int seconds) it sets a transaction timeout for any transaction started by a subsequent call to begin on this instance.
5. boolean isAlive() checks if the transaction is still alive.
6. void registerSynchronization(Synchronization s) registers a user synchronization callback for this transaction.
7. boolean wasCommited() checks if the transaction is commited successfully.
8. boolean wasRolledBack() checks if the transaction is rolledback successfully.
For more information, visit the following links:
- [Hibernate Transaction Management Example](https://www.javatpoint.com/hibernate-transaction-management-example#:~:text=A%20transaction%20simply%20represents%20a,Consistency%2C%20Isolation%20and%20Durability).)
- [Hibernate Transaction Management Example](https://www.javatpoint.com/hibernate-transaction-management-example)
- [Hibernate Transaction Management](https://www.javaguides.net/2018/12/hibernate-transaction-management-tutorial.html)
- [Hibernate Transaction](https://www.w3schools.blog/hibernate-transaction-management)

@ -1,12 +1,8 @@
# Relationships
Using hibernate, if we want to put relationship between two entities [ objects of two pojo classes ], then in the database tables, there must exist foreign key relationship, we call it as Referential integrity.
Using hibernate, if we want to have relationship between two entities, there must exist a foreign key relationship between the tables, we call it as Referential integrity. The main advantage of having relationship between objects is, we can do operation on one object, and the same operation can transfer onto the other object in the database.
The main advantage of putting relation ship between objects is, we can do operation on one object, and the same operation can transfer onto the other object in the database [ remember, object means one row in hibernate terminology ]
While selecting, it is possible to get data from multiple tables at a time if there exits relationship between the tables, nothing but in hibernate relationships between the objects
Using hibernate we can put the following 4 types of relationships
Here are the four tyeps of relationships we can have between objects in Hibernate.
- One-To-One
- Many-To-One

@ -1,49 +1,17 @@
# Entity lifecycle
Here we will learn about Hibernate Lifecycle or in other words, we can say that we will learn about the lifecycle of the mapped instances of the entity/object classes in hibernate. In Hibernate, we can either create a new object of an entity and store it into the database, or we can fetch the existing data of an entity from the database. These entity is connected with the lifecycle and each object of entity passes through the various stages of the lifecycle.
In Hibernate, we can either create a new object of an entity and store it into the database, or we can fetch the existing data of an entity from the database. These entity is connected with the lifecycle and each object of entity passes through the various stages of the lifecycle.
There are mainly four states of the Hibernate Lifecycle :
1. Transient State
2. Persistent State
3. Detached State
4. Removed State
**State 1: Transient State**
The transient state is the first state of an entity object. When we instantiate an object of a POJO class using the new operator then the object is in the transient state. This object is not connected with any hibernate session. As it is not connected to any Hibernate Session, So this state is not connected to any database table. So, if we make any changes in the data of the POJO Class then the database table is not altered. Transient objects are independent of Hibernate, and they exist in the heap memory.
Changing new object to Transient State. There are two layouts in which transient state will occur as follows:
- When objects are generated by an application but are not connected to any session.
- The objects are generated by a closed session.
**State 2: Persistent State**
Once the object is connected with the Hibernate Session then the object moves into the Persistent State. So, there are two ways to convert the Transient State to the Persistent State :
- Using the hibernated session, save the entity object into the database table.
- Using the hibernated session, load the entity object into the database table.
In this state. each object represents one row in the database table. Therefore, if we make any changes in the data then hibernate will detect these changes and make changes in the database table.
**State 3: Detached State**
For converting an object from Persistent State to Detached State, we either have to close the session or we have to clear its cache. As the session is closed here or the cache is cleared, then any changes made to the data will not affect the database table. Whenever needed, the detached object can be reconnected to a new hibernate session.
**State 4: Removed State**
In the hibernate lifecycle it is the last state. In the removed state, when the entity object is deleted from the database then the entity object is known to be in the removed state. It is done by calling the delete() operation. As the entity object is in the removed state, if any change will be done in the data will not affect the database table.
- Transient State
- Persistent State
- Detached State
- Removed State
For more resources, visit the following links:
- [Hibernate Lifecycle](https://www.geeksforgeeks.org/hibernate-lifecycle/)
- [Entity Lifecycle in Hibernate](https://www.javatpoint.com/hibernate-lifecycle)
- [Hibernate Entity Lifecycle & and its state](https://www.baeldung.com/hibernate-entity-lifecycle#:~:text=Every%20Hibernate%20entity%20naturally%20has,able%20to%20use%20Hibernate%20properly.)
- [Hibernate Lifecycle](https://www.geeksforgeeks.org/hibernate-lifecycle/)
- [Entity Lifecycle in Hibernate](https://www.javatpoint.com/hibernate-lifecycle)
- [Hibernate Entity Lifecycle & and its state](https://www.baeldung.com/hibernate-entity-lifecycle)

@ -1,6 +1,6 @@
# Hibernate
Spring is an open-source framework developed by pivotal is an application framework and inversion of control container for the Java platform which provides infrastructure support for developing applications. Hibernate is a Java framework that provides an object-relational mapping to an object-oriented model to the relational database. It means hibernate provides from Java classes to database tables and also provides data querying and retrieval facility.
Hibernate is a Java framework that provides an object-relational mapping to an object-oriented model to the relational database. It means hibernate provides from Java classes to database tables and also provides data querying and retrieval facility.
For more resources, visit the following links:

@ -1,10 +1,9 @@
# Spring data jpa
# Spring Data JPA
Spring Data JPA is a library that makes it easy to implement Java Persistence API (JPA) based repositories (a fancy word for "DAO") for Spring applications. It's an abstraction on top of JPA that allows you to use a simpler and more convenient API for performing CRUD (Create, Read, Update, Delete) operations on databases. Spring Data JPA also provides additional functionality such as pagination, dynamic query generation, and more.
For more resources, visit the following links:
- [Spring Data JPA](https://spring.io/projects/spring-data-jpa#:~:text=Spring%20Data%20JPA%20aims%20to,will%20provide%20the%20implementation%20automatically.)
- [Spring Data JPA](https://spring.io/projects/spring-data-jpa)
- [Introduction to Spring Data JPA](https://www.baeldung.com/the-persistence-layer-with-spring-data-jpa)
- [Spring Data JPA Tutorial](https://www.javatpoint.com/spring-and-jpa-integration)

@ -1,23 +1,12 @@
# Spring data mongodb
# Spring Data Mongodb
Spring Data for MongoDB is part of the umbrella Spring Data project which aims to provide a familiar and consistent Spring-based programming model for new datastores while retaining store-specific features and capabilities
The Spring Data MongoDB project provides integration with the MongoDB document database. Key functional areas of Spring Data MongoDB are a POJO centric model for interacting with a MongoDB DBCollection and easily writing a Repository style data access layer.
Some of its features are as follow:
- Spring configuration support using Java based @Configuration classes or an XML namespace for a Mongo driver instance and replica sets.
- MongoTemplate helper class that increases productivity performing common Mongo operations. Includes integrated object mapping between documents and POJOs.
- Exception translation into Spring’s portable Data Access Exception hierarchy.
- Feature Rich Object Mapping integrated with Spring’s Conversion Service.
- Annotation based mapping metadata but extensible to support other metadata formats.
- Persistence and mapping lifecycle events.
- Low-level mapping using MongoReader/MongoWriter abstractions etc.
For more resources on spring data mongodb, visit the following links:
- [Spring Data MongoDB](https://spring.io/projects/spring-data-mongodb#:~:text=Spring%20Data%20for%20MongoDB%20is,store%2Dspecific%20features%20and%20capabilities.)
- [Spring Data MongoDB](https://spring.io/projects/spring-data-mongodb)
- [Introduction to Spring Data MongoDB](https://www.baeldung.com/spring-data-mongodb-tutorial)
- [Spring Boot Integration with MongoDB Tutorial](https://www.mongodb.com/compatibility/spring-boot)

@ -1,9 +1,9 @@
# Spring data jdbc
# Spring Data JDBC
Spring Data JDBC is a part of the Spring Data project that provides support for using JDBC (Java Database Connectivity) to interact with relational databases. It is designed to provide a simple and consistent programming model for interacting with databases using JDBC, while still allowing for the full power of JDBC to be used if needed. Spring Data JDBC provides a set of abstraction and utility classes that simplify the task of working with databases, such as a simple template class for executing SQL queries, a repository abstraction for implementing data access objects (DAOs), and support for pagination and sorting of query results. It works with both Java and Kotlin.
Visit the following links for more resources on spring data jdbc:
- [Spring Data JDBC](https://spring.io/projects/spring-data-jdbc#:~:text=Spring%20Data%20JDBC%2C%20part%20of,that%20use%20data%20access%20technologies.)
- [Spring Data JDBC](https://spring.io/projects/spring-data-jdbc)
- [Spring Data JDBC - Reference Documentation](https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/)
- [Introduction to Spring Data JDBC](https://www.baeldung.com/spring-data-jdbc-intro)

@ -1,10 +1,10 @@
# Spring data
# Spring Data
Spring Data is a collection of projects for data access in Spring-based applications. It provides a common interface for working with various types of data stores, including relational databases, NoSQL data stores, and cloud-based data services. The goal of Spring Data is to simplify data access in Spring applications by providing a consistent, high-level repository programming model across different data stores and data access technologies. This can help developers write less boilerplate code and focus on business logic, while still being able to take advantage of the full power of the underlying data store.
For more resources, visit the following links:
- [Spring Data](https://spring.io/projects/spring-data#:~:text=2022.0.0,of%20the%20underlying%20data%20store.)
- [Spring Data](https://spring.io/projects/spring-data)
- [Spring Data – One API To Rule Them All?](https://www.infoq.com/articles/spring-data-intro/)
- [What is JPA, Spring Data and Spring Data JPA](https://www.amitph.com/jpa-and-spring-data-jpa/)

@ -1,15 +1,12 @@
# Spring cloud gateway
# Spring Cloud Gateway
Spring Cloud Gateway is a Spring Framework library for building API gateways. An API gateway is a service that acts as an intermediary between an application and a set of microservices. The API gateway is responsible for request routing, composition, and protocol translation, among other things. It can also perform tasks such as authentication, rate limiting, and caching.
Spring Cloud Gateway is built on top of the Spring Framework and Spring Boot, and it integrates with other Spring projects such as Spring Cloud Netflix and Spring Security. It provides a simple, yet powerful way to route and manage requests to microservices, allowing developers to focus on business logic instead of writing boilerplate code to handle common API gateway tasks.
It also allows developers to define routes, predicates and filters to intercept the requests and process accordingly and also has support for using load balancer patterns like Netflix Ribbon. With the help of this feature developer can use the gateway as a central point of entry to handle cross-cutting concerns like security, rate-limiting etc.
Visit the following links for more resources:
- [What is Spring Cloud Gateway?](https://tanzu.vmware.com/developer/guides/scg-what-is/#:~:text=Spring%20Cloud%20Gateway%20provides%20a,security%2C%20resiliency%2C%20and%20monitoring.)
- [What is Spring Cloud Gateway?](https://tanzu.vmware.com/developer/guides/scg-what-is/)
- [Spring Cloud Gateway](https://spring.io/projects/spring-cloud-gateway)
- [Exploring the New Spring Cloud Gateway](https://www.baeldung.com/spring-cloud-gateway)

@ -1,16 +1,12 @@
# Cloud config
# Cloud Config
Spring Cloud Config is a library for managing configuration properties for distributed applications. It allows developers to externalize configuration properties for an application, so that they can be easily changed without modifying the application's code. It also provides a centralized server for storing and managing configuration properties for multiple applications, making it easy to update and rollback configurations across different environments.
Spring Cloud Config Server is an HTTP server that provides a REST API for managing configuration properties. It can store configuration properties in a variety of back-ends such as a file system, a Git repository, or a database. The server also supports encryption and decryption of sensitive properties.
Spring Cloud Config Client is a library that can be included in an application, and it connects to the Config Server to retrieve the properties needed for the application to run. The client can also be configured to automatically refresh the properties when they change, so that the application can pick up the new values without having to be restarted.
By using Spring Cloud Config, developers can have a centralized and consistent approach for managing the configuration properties of their microservices or distributed applications, making it easy to modify the properties without having to change the code, also it helps in maintaining different environment configuration easily.
For more resources, visit the following links:
- [Spring Cloud Config](https://spring.io/projects/spring-cloud-config#:~:text=Spring%20Cloud%20Config%20provides%20server,for%20applications%20across%20all%20environments.)
- [Spring Cloud Config](https://spring.io/projects/spring-cloud-config)
- [Quick Intro to Spring Cloud Configuration](https://www.baeldung.com/spring-cloud-configuration)
- [Spring Boot - Cloud Configuration Server](https://www.tutorialspoint.com/spring_boot/spring_boot_cloud_configuration_server.htm)

@ -1,15 +1,10 @@
# Spring cloud circuit breaker
# Circuit Breaker
Spring Cloud Circuit Breaker is a library for managing the fault tolerance of microservices-based applications using the Circuit Breaker pattern. The Circuit Breaker pattern is a design pattern that helps to prevent cascading failures and improve the resilience of distributed systems. It does this by introducing a "circuit breaker" proxy in front of a service that can detect when the service is unresponsive or has failed, and stop routing traffic to it temporarily, in order to allow the service to recover.
Spring Cloud Circuit Breaker integrates with popular circuit breaker libraries like Netflix Hystrix, and provides a consistent programming model across different libraries. It also allows developers to easily instrument their code and monitor the health of their microservices using Spring Boot Actuator and Micrometer.
It also has features like fallback methods, request volume threshold and request timeout threshold, to handle the situation when the service is down or under heavy load, so that the application can continue to function, rather than failing completely. Spring Cloud Circuit Breaker also helps in managing the number of concurrent requests and preventing cascading failures, thus making the application more resilient to failures and improve its overall availability.
For more resources, visit the following links:
- [Spring Cloud Circuit Breaker](https://spring.io/projects/spring-cloud-circuitbreaker#:~:text=Spring%20Cloud%20Circuit%20breaker%20provides,your%20needs%20for%20your%20app.)
- [Spring Cloud Circuit Breaker](https://spring.io/projects/spring-cloud-circuitbreaker)
- [Quick Guide to Spring Cloud Circuit Breaker](https://www.baeldung.com/spring-cloud-circuit-breaker)
- [Spring Cloud - Circuit Breaker using Hystrix](https://www.tutorialspoint.com/spring_cloud/spring_cloud_circuit_breaker_using_hystrix.htm)

@ -1,13 +1,9 @@
# Spring cloud openfeign
# Spring Cloud OpenFeign
Spring Cloud OpenFeign is a library for creating declarative REST clients in Spring applications. It allows developers to easily make HTTP requests to other microservices or remote services, without having to manually write the low-level code to handle the requests and responses. OpenFeign is built on top of the OpenFeign declarative HTTP client, which is a simple, lightweight library for creating HTTP clients in Java.
Spring Cloud OpenFeign provides a consistent, easy-to-use programming model for making RESTful calls, and it integrates seamlessly with Spring Cloud Netflix and Ribbon to provide load balancing and service discovery. It also supports other Spring projects such as Spring Security and Spring Retry. It uses interfaces and annotations to define the REST endpoints, so that the underlying HTTP request can be handled by Feign, allowing for more readable and easy to reason about code.
With the help of OpenFeign, developers can write simple and clean code to call the other microservices, without having to worry about the underlying HTTP request and responses, it also provides a lot of features out of the box like Retry, Circuit breaker patterns, Load balancing etc. This makes the code more readable and easy to maintain, also make it easier to test.
For more resources, visit the following links:
- [Introduction to Spring Cloud OpenFeign](https://www.baeldung.com/spring-cloud-openfeign#:~:text=In%20this%20tutorial%2C%20we're,annotations%20and%20JAX%2DRS%20annotations.)
- [Introduction to Spring Cloud OpenFeign](https://www.baeldung.com/spring-cloud-openfeign)
- [Spring Cloud OpenFeign](https://spring.io/projects/spring-cloud-openfeign)
- [Simple Implementation of Spring Cloud OpenFeign](https://medium.com/javarevisited/simple-implementation-of-spring-cloud-openfeign-7f022630d01d)

@ -1,12 +1,6 @@
# Hystrix
Spring Cloud Hystrix is a library for managing the fault tolerance of microservices-based applications using the Circuit Breaker pattern. It integrates with the Netflix Hystrix library, which provides an implementation of the Circuit Breaker pattern.
Hystrix is a latency and fault tolerance library designed to isolate points of access to remote systems, services and 3rd party libraries, stop cascading failure and enable resilience in complex distributed systems where failure is inevitable.
Spring Cloud Hystrix allows developers to easily instrument their code and monitor the health of their microservices using Spring Boot Actuator and Micrometer. It also provides a consistent programming model across different libraries, and allows developers to use annotations to enable circuit breaker functionality.
With the help of Spring Cloud Hystrix, developers can write code that will automatically fail over to a fallback method or response when a service becomes unavailable or unresponsive, thus preventing cascading failures. It also has a feature called a "Hystrix Dashboard" which provides a web interface for monitoring the health and performance of microservices and the ability to trigger, stop and monitor the fallback methods.
Spring Cloud Hystrix is a library for managing the fault tolerance of microservices-based applications using the Circuit Breaker pattern. It is a latency and fault tolerance library designed to isolate points of access to remote systems, services and 3rd party libraries, stop cascading failure and enable resilience in complex distributed systems where failure is inevitable. You can use it to easily instrument your code and monitor the health of your microservices using Spring Boot Actuator and Micrometer. It also provides a consistent programming model across different libraries, and allows developers to use annotations to enable circuit breaker functionality.
For more resources, visit the following links:

@ -2,9 +2,7 @@
Spring Cloud Sleuth is a library for distributed tracing in Spring-based applications. Distributed tracing is a technique that allows developers to track the flow of a request as it travels through a microservices-based application, in order to understand how the different components of the system are interacting and to identify and troubleshoot performance bottlenecks.
Spring Cloud Sleuth provides a simple, consistent way to add trace information to the requests flowing through a Spring-based application. It automatically adds trace information, such as trace and span IDs, to requests and responses, so that developers can easily correlate requests as they travel through the different services and components of their application. It also integrates with other distributed tracing systems such as Zipkin, so that developers can use the same trace information across different systems.
It also supports log correlation, so that developers can easily see the trace information in their application logs. By using Spring Cloud Sleuth developer can easily debug, troubleshoot and monitor the microservices based application by tracing the requests throughout the different microservices.
Spring Cloud Sleuth provides a simple, consistent way to add trace information to the requests flowing through a Spring-based application. It automatically adds trace information, such as trace and span IDs, to requests and responses, so that developers can easily correlate requests as they travel through the different services and components of their application.
For more resources, visit the following links:

@ -4,15 +4,9 @@ Spring Cloud Eureka is a library for service discovery in a microservices-based
Eureka is a service registry that allows service instances to register themselves and to discover other services by name. It provides a simple, consistent way for services to find and communicate with each other, and it integrates with other Spring Cloud libraries such as Ribbon and Feign to provide load balancing and declarative REST clients.
When a service starts up, it registers itself with the Eureka server, and the server keeps track of all the services and their instances, along with their health status and other metadata.
When another service needs to communicate with a service, it looks up the Eureka server to find the instances of the service it needs, it can also use this information to do load balancing. The client-side load balancer will use this information to route requests to available instances of the service.
By using Spring Cloud Eureka, developers can build their microservices-based applications with self-discovery and self-registration capabilities, making it easier to scale and manage those applications, also provides a simple and consistent way to implement service discovery and registration, allowing microservices to easily find and communicate with each other.
For more resources, visit the following links:
- [Introduction to Spring Cloud Netflix – Eureka](https://www.baeldung.com/spring-cloud-netflix-eureka#:~:text=a%20service%20registry%20(Eureka%20Server,Spring%20Cloud%20Netflix%20Feign%20Client))
- [Introduction to Spring Cloud Netflix – Eureka](https://www.baeldung.com/spring-cloud-netflix-eureka)
- [Spring Boot - Eureka Server](https://www.tutorialspoint.com/spring_boot/spring_boot_eureka_server.htm)
- [Introducing Spring Cloud EUREKA](https://www.youtube.com/watch?v=1uNo1NrqsX4)

@ -2,10 +2,8 @@
Spring Microservices is a framework that makes it easier to build and manage microservices-based applications using the Spring Framework. Microservices is an architectural style in which a large application is built as a collection of small, independently deployable services. Each service has a narrowly defined responsibility and communicates with other services through APIs.
Spring Microservices provides a set of tools and best practices for building and deploying microservices, and integrates with other Spring projects such as Spring Boot, Spring Cloud, and Spring Data to provide a cohesive and consistent development experience. It also provides a number of features that are useful for building microservices, such as service discovery, load balancing, and configuration management. With the help of Spring Microservices, developer can build, test, and deploy microservices more easily and efficiently.
For more resources, visit the following links:
- [Microservices with Spring](https://spring.io/microservices#:~:text=Microservices%20with%20Spring%20Boot,ready%20to%20go%20in%20minutes.)
- [Microservices with Spring](https://spring.io/microservices)
- [Microservices Tutorial](https://www.javatpoint.com/microservices)
- [Microservices with Spring Boot ](https://medium.com/omarelgabrys-blog/microservices-with-spring-boot-intro-to-microservices-part-1-c0d24cd422c3)

@ -4,7 +4,7 @@ A Spring servlet is a Java class that serves as the central point for handling r
For more information, visit the following links:
- [DispatcherServlet and web.xml in Spring Boot](https://www.baeldung.com/spring-boot-dispatcherservlet-web-xml#:~:text=The%20DispatcherServlet%20is%20the%20front,xml%20file.)
- [DispatcherServlet and web.xml in Spring Boot](https://www.baeldung.com/spring-boot-dispatcherservlet-web-xml)
- [The DispatcherServlet](https://docs.spring.io/spring-framework/docs/3.0.0.M4/spring-framework-reference/html/ch15s02.html)
- [What is Dispatcher Servlet in Spring?](https://www.geeksforgeeks.org/what-is-dispatcher-servlet-in-sprin)

@ -1,13 +1,9 @@
# Jsp files
# JSP Files
Spring MVC is a web framework that is part of the Spring Framework, and is designed to make it easy to build web applications using the Model-View-Controller (MVC) design pattern. JSP (JavaServer Pages) is a technology for building dynamic web pages using Java.
JSP (JavaServer Pages) is a technology for building dynamic web pages using Java.
In a Spring MVC application that uses JSPs, the view component of the MVC pattern is implemented using JSP files. The JSP files contain the presentation logic for the application and are responsible for generating the HTML that is sent to the client's web browser. When a user makes a request to a Spring MVC application, the DispatcherServlet, which acts as the front controller, handles the request and delegates responsibility for generating the response to the appropriate JSP file.
The Spring Framework provides a tag library called Spring Form tags, which can be used in JSP files to create forms and handle form submissions. In addition to this, it provides a powerful abstraction to access data from the Model, making it easy to display the data in JSP files.
The JSP files are typically placed in the webapp/WEB-INF/jsp directory of a Spring MVC application, although the location can be configured using the Spring's ViewResolver.
Visit the following links for more resources:
- [Spring MVC with JSP View](https://www.geeksforgeeks.org/spring-mvc-with-jsp-view/)

@ -1,20 +1,6 @@
# Architecture
The Spring MVC (Model-View-Controller) architecture is a web application framework that is part of the Spring Framework. It is designed to make it easy to build web applications using the MVC design pattern.
In the Spring MVC architecture, the application is divided into three main components:
- Model: This represents the data and the business logic of the application. It can be implemented using JavaBeans, POJOs or other Java objects.
- View: This represents the presentation logic of the application, and is responsible for generating the HTML that is sent to the client's web browser In Spring MVC, views are typically implemented using JSPs, but other view technologies such as Thymeleaf, FreeMarker, Velocity can also be used.
- Controller: This acts as the intermediary between the Model and the View, and is responsible for handling HTTP requests and generating the appropriate response.
When a user makes a request to a Spring MVC application, the DispatcherServlet, which acts as the front controller, handles the request. It's responsibility is to delegate it to the appropriate controller, and that controller perform any business logic necessary on the Model and then forward or redirect it to the appropriate view.
The Spring MVC architecture also includes other components such as the Spring IoC container, which manages the lifecycle of the application's objects, and the Spring's ViewResolver, which is responsible for resolving views based on the request and configured view resolvers.
Overall, Spring MVC's architecture promotes the separation of concerns and ease of testing, while providing a robust set of features, such as a powerful data binding and validation, flexible view resolution and different type of file format support.
The Spring MVC (Model-View-Controller) is a web application framework that is part of the Spring Framework. It is designed to make it easy to build web applications using the MVC design pattern.
For more resources, visit the following resources:

@ -2,22 +2,20 @@
The Spring MVC (Model-View-Controller) framework has several key components that work together to handle the requests and generate the appropriate responses in a web application. These components include:
- DispatcherServlet: This is the front controller of the Spring MVC architecture. It is responsible for handling incoming requests, delegating responsibility to other components, and ultimately returning a response to the user.
- Controller: Controllers handle the incoming requests, perform any necessary business logic on the Model, and then forward or redirect the request to the appropriate view.
- Model: The Model represents the data and the business logic of the application. It can be implemented using JavaBeans, POJOs, or other Java objects.
- View: The View is responsible for generating the HTML that is sent to the client's web browser. In Spring MVC, views are typically implemented using JSPs, but other view technologies such as Thymeleaf, FreeMarker, Velocity can also be used.
- ViewResolver: This is responsible for resolving views based on the request and configured view resolvers. It maps logical view names to actual views, such as JSPs or Thymeleaf templates.
- Form Controllers: These are special type of controllers that handle form submissions, and are responsible for data binding, validation and error handling.
- HandlerMapping: This maps requests to appropriate controllers, responsible for handling the requests.
- HandlerAdapter: This is used to handle the request and generate the response.
- `DispatcherServlet`: This is the front controller of the Spring MVC architecture. It is responsible for handling incoming requests, delegating responsibility to other components, and ultimately returning a response to the user.
- `Controller`: Controllers handle the incoming requests, perform any necessary business logic on the Model, and then forward or redirect the request to the appropriate view.
- `Model`: The Model represents the data and the business logic of the application. It can be implemented using JavaBeans, POJOs, or other Java objects.
- `View`: The View is responsible for generating the HTML that is sent to the client's web browser. In Spring MVC, views are typically implemented using JSPs, but other view technologies such as Thymeleaf, FreeMarker, Velocity can also be used.
- `ViewResolver`: This is responsible for resolving views based on the request and configured view resolvers. It maps logical view names to actual views, such as JSPs or Thymeleaf templates.
- `Form Controllers`: These are special type of controllers that handle form submissions, and are responsible for data binding, validation and error handling.
- `HandlerMapping`: This maps requests to appropriate controllers, responsible for handling the requests.
- `HandlerAdapter`: This is used to handle the request and generate the response.
There are other supporting components that are used to manage the lifecycle of the application's objects, such as the Spring IoC container and different interceptors that provides additional functionality, such as caching and security.
Overall, Spring MVC's architecture promotes the separation of concerns and ease of testing, while providing a robust set of features, such as a powerful data binding and validation, flexible view resolution and different type of file format support.
For more information, visit the following links:
- [Spring Components](https://rollbar.com/blog/spring-boot-vs-spring-mvc-how-do-they-compare/#:~:text=Spring%20MVC%20uses%20three%20components,and%20logic%20the%20application%20uses.)
- [Spring Boot vs Spring MVC: How do They Compare?](https://rollbar.com/blog/spring-boot-vs-spring-mvc-how-do-they-compare/)
- [Spring MVC components](http://makble.com/spring-mvc-components)

@ -1,21 +1,11 @@
# Spring mvc
# Spring MVC
Spring MVC is a web application framework that is part of the Spring Framework. It is designed to make it easy to build web applications using the Model-View-Controller (MVC) design pattern.
In Spring MVC, the application is divided into three main components: the Model, the View, and the Controller. The Model represents the data and the business logic of the application, the View is responsible for generating the HTML that is sent to the client's web browser, and the Controller acts as an intermediary between the Model and the View, handling incoming HTTP requests and generating the appropriate response.
The DispatcherServlet is the central point for handling requests in a Spring MVC application. It acts as the front controller, receiving all incoming requests and delegating responsibility to other components.
The Spring Framework provides a rich set of features for building web applications, including support for data binding and validation, flexible view resolution, and different file format support, such as JSPs, Thymeleaf and others. It also provides other supporting components such as the Spring IoC container, which manages the lifecycle of the application's objects, and various interceptors that can be used to add additional functionality such as caching and security.
Spring MVC promotes separation of concerns, testability and ease of testing, making it easy to build and maintain web applications.
For more information, visit the following links:
- [Spring MVC Tutorial](https://www.javatpoint.com/spring-mvc-tutorial)
- [Spring - MVC Framework](https://www.tutorialspoint.com/spring/spring_web_mvc_framework.htm)
- [Spring MVC Tutorial – Everything You Need To Know](https://www.edureka.co/blog/spring-mvc-tutorial/)
- [Spring MVC Tutorial – Everything You Need To Know](https://www.edureka.co/blog/spring-mvc-tutorial/)

@ -1,4 +1,4 @@
# Jpa test
# JPA Test
Spring JPA (Java Persistence API) is a library that makes it easy to work with databases and other data stores in a Spring application. Spring JPA uses the Java Persistence API (JPA) to interact with databases and provides an abstraction layer to work with different data stores.
@ -8,7 +8,7 @@ There are several ways to test the persistence layer using Spring JPA. One way i
Spring Test module provides different annotations such as @DataJpaTest and @AutoConfigureTestDatabase that facilitates the testing of JPA specific functionality.
Additionally, Spring provides the JPA Testing Utilities, which provides a set of utility classes and annotations to test JPA-based persistence layer easily, such as @DataJpaTest, @AutoConfigureTestDatabase, and TestEntityManager classes. These utilities can be used to create, read, update, and delete entities, perform JPA queries, and interact with the database during the test.
Additionally, Spring provides the JPA Testing Utilities, which provides a set of utility classes and annotations to test JPA-based persistence layer easily, such as `@DataJpaTest`, `@AutoConfigureTestDatabase`, and TestEntityManager classes. These utilities can be used to create, read, update, and delete entities, perform JPA queries, and interact with the database during the test.
Testing the persistence layer separately from the rest of the application allows to catch any issues early in the development process, making it easy to identify and fix bugs and improve the quality of the application.

@ -1,19 +1,11 @@
# Mock mvc
# Mock MVC
Spring's MockMvc is a class that allows you to test Spring MVC controllers without the need for an actual web server. It is part of the Spring Test module, which provides a set of testing utilities for Spring applications.
MockMvc is a powerful testing tool that allows you to test your controllers using a mock servlet environment. It simulates the behavior of a real web container and allows you to test your controllers in isolation from the rest of the application.
To use MockMvc, you first need to create an instance of it by providing it with a standalone setup of your controller, this can be done using MockMvcBuilders. Once you have an instance of MockMvc, you can use its API to perform various HTTP requests, such as GET, POST, PUT, DELETE, etc. on your controllers and test the responses.
MockMvc provides a lot of flexibility and configurability, you can setup request headers, request parameters, test different type of request and response, test security and a lot more. It also provides a lot of assert methods to validate the response received by the controller, such as checking the HTTP status code, the headers, and the content of the response.
Spring's MockMvc is a powerful tool for testing Spring MVC controllers, it allows to test the controllers in isolation from the rest of the application, mock requests and responses, test security and a lot more. It also allows to catch issues early in the development process, making it easy to identify and fix bugs and improve the quality of the application.
For more information, visit the following link:
- [Spring MockMvc tutorial](https://zetcode.com/spring/mockmvc/#:~:text=MockMvc%20is%20defined%20as%20a,between%20unit%20and%20integration%20tests.)
- [Spring MockMVC tutorial](https://zetcode.com/spring/mockmvc/)
- [Spring Boot MockMVC Example](https://howtodoinjava.com/spring-boot2/testing/spring-boot-mockmvc-example/)
- [Integration Testing in Spring](baeldung.com/integration-testing-in-spring)

@ -1,27 +1,9 @@
# Spring boot test annotation
Spring Boot provides several test annotations to make it easy to test Spring Boot applications. Some of the most commonly used annotations include:
- @SpringBootTest: This annotation is used to create a fully-configured instance of the Spring ApplicationContext for testing. It can be used to test the application's components, including controllers, services, and repositories, in a real application environment.
- @WebMvcTest: This annotation is used to test Spring MVC controllers and is typically used in combination with @MockBean or @AutoConfigureMockMvc to provide a mock environment. It can be used to test the controllers in isolation from the rest of the application.
- @DataJpaTest : This annotation is used to test Spring Data JPA repositories and is typically used in combination with @AutoConfigureTestDatabase to provide a test database environment. It can be used to test the JPA repositories in isolation from the rest of the application.
- @JsonTest : This annotation is used to test JSON serialization and deserialization. It can be used to test the JSON parsing and serialization functionality of the application.
- @RestClientTest : This annotation is used to test Spring RestTemplate based clients. It can be used to test the Rest clients in isolation from the rest of the application
These annotations can be used in conjunction with other testing libraries like JUnit, AssertJ, Hamcrest and Mockito to create powerful and flexible test suites for Spring Boot applications. Spring Boot also provide a set of TestExecutionListener that can be used to further customize the test setup
Spring Boot's test annotations provide a powerful and flexible way to test Spring Boot applications, making it easy to test various aspects of the application, including the controllers, services, repositories, and JSON parsing functionality.
`@SpringBootTest` This annotation is used to create a fully-configured instance of the Spring ApplicationContext for testing. It can be used to test the application's components, including controllers, services, and repositories, in a real application environment.
For more information, visit the following links:
- [Testing with Spring Boot and @SpringBootTest](https://reflectoring.io/spring-boot-test/)
- [Annotation Interface SpringBootTest](https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/context/SpringBootTest.html)
- [Testing in Spring Boot](https://www.baeldung.com/spring-boot-testing)
- [Testing in Spring Boot](https://www.baeldung.com/spring-boot-testing)

@ -1,20 +1,9 @@
# Mockbean annotation
# Mockbean Annotation
MockBean is a Spring annotation that can be used to create a mock implementation of a bean in the Spring application context. When a test is annotated with MockBean, Spring creates a mock implementation of the specified bean and adds it to the application context. The mock bean can then be used to replace the real bean during testing.
This annotation can be used to create a mock implementation of any type of bean, such as a service, repository, or controller. For example, if you have a service bean that interacts with a database, you can use MockBean to create a mock implementation of the service bean that can be used during testing, so that the test does not depend on the actual database.
MockBean also provides several features like name, answer and more, that can be used to customize the mock creation and its behavior during test execution.
MockBean can be used in conjunction with other testing libraries like JUnit, AssertJ, Hamcrest and Mockito to create powerful and flexible test suites. It is commonly used in conjunction with @WebMvcTest, @DataJpaTest, and other testing annotations to isolate specific parts of the application and test them in isolation.
In summary MockBean is a powerful and flexible tool that can be used to create mock implementations of beans in a Spring application. It allows to replace real beans with mocks during testing, so that the tests do not depend on the actual implementation, but just the contract. It is a powerful tool to create isolated and focused tests.
`MockBean` is a Spring annotation that can be used to create a mock implementation of a bean in the Spring application context. When a test is annotated with MockBean, Spring creates a mock implementation of the specified bean and adds it to the application context. The mock bean can then be used to replace the real bean during testing.
For more information, visit the following links:
- [Mockito.mock() vs @Mock vs @MockBean](https://www.baeldung.com/java-spring-mockito-mock-mockbean#:~:text=Spring%20Boot's%20%40MockBean%20Annotation&text=The%20mock%20will%20replace%20any,service%2C%20needs%20to%20be%20mocked.)
- [Mockito.mock() vs @Mock vs @MockBean](https://www.baeldung.com/java-spring-mockito-mock-mockbean)
- [Spring Boot @MockBean Example](https://howtodoinjava.com/spring-boot2/testing/spring-mockbean-annotation/)
- [Annotation Interface MockBean](https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/mock/mockito/MockBean.html)
- [Annotation Interface MockBean](https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/mock/mockito/MockBean.html)

@ -1,27 +1,10 @@
# Testing
Spring Testing is a set of testing utilities for Spring applications that makes it easy to test the various components of a Spring application, including controllers, services, repositories, and other components. Spring Testing provides a rich set of testing annotations, utility classes and other features to aid in unit testing, integration testing and more.
Spring Testing can be used in conjunction with various testing libraries like JUnit, AssertJ, Hamcrest and Mockito to create powerful and flexible test suites.
Some of the key features of Spring Testing include:
- Support for testing Spring MVC controllers using @WebMvcTest and MockMvc
- Support for testing Spring Data JPA repositories using @DataJpaTest
- Support for testing Spring's JSON serialization and deserialization using @JsonTest
- Support for testing Spring's RestTemplate based clients using @RestClientTest
- Support for creating and managing test slices of the Application context with @SpringBootTest, @WebMvcTest, @DataJpaTest and more.
Spring Testing also provides a lot of utility classes and annotations to make testing Spring applications easier, such as TestEntityManager for-JPA testing, MockHttpServletRequest and MockHttpServletResponse for testing controllers, TestRestTemplate for testing RestTemplate clients, and more.
Overall, Spring Testing is a robust and powerful set of testing utilities that makes it easy to test Spring applications, promote good testing practices, improve the quality of the code and catch issues early in the development process.
Spring provides a set of testing utilities that make it easy to test the various components of a Spring application, including controllers, services, repositories, and other components. It has a rich set of testing annotations, utility classes and other features to aid in unit testing, integration testing and more.
For more information, visit the following links:
- [Spring Testing](https://industrialphysics.com/knowledgebase/articles/spring-testing/#:~:text=Spring%20testing%20on%20a%20universal,displacement%20in%20static%20testing%20applications.)
- [Spring Testing](https://industrialphysics.com/knowledgebase/articles/spring-testing/)
- [What Is Spring Testing?](https://www.developer.com/design/what-is-spring-testing/)
- [Complete Guide To Spring Testing](https://www.lambdatest.com/blog/spring-testing/)
- [Complete Guide To Spring Testing](https://www.lambdatest.com/blog/spring-testing/)
Loading…
Cancel
Save