parent
fa9d8d6656
commit
fc6e8048a7
49 changed files with 120 additions and 501 deletions
@ -1,20 +1,9 @@ |
|||||||
# Oauth2 |
# 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. |
|
||||||
|
|
||||||
|
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: |
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 Boot and OAuth2](https://spring.io/guides/tutorials/spring-boot-oauth2/) |
||||||
- [Spring Security](https://www.tutorialspoint.com/spring_security/spring_security_with_oauth2.htm) |
- [Spring Security](https://www.tutorialspoint.com/spring_security/spring_security_with_oauth2.htm) |
@ -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. |
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. |
||||||
|
|
||||||
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. |
|
||||||
|
|
||||||
For more resources, visit the following links: |
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) |
- [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) |
- [Embedded Web Servers ‘How-to’ guides](https://docs.spring.io/spring-boot/docs/2.1.9.RELEASE/reference/html/howto-embedded-web-servers.html) |
@ -1,49 +1,17 @@ |
|||||||
# Entity lifecycle |
# 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 : |
There are mainly four states of the Hibernate Lifecycle : |
||||||
|
|
||||||
1. Transient State |
- Transient State |
||||||
2. Persistent State |
- Persistent State |
||||||
3. Detached State |
- Detached State |
||||||
4. Removed State |
- 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. |
|
||||||
|
|
||||||
|
|
||||||
For more resources, visit the following links: |
For more resources, visit the following links: |
||||||
|
|
||||||
- [Hibernate Lifecycle](https://www.geeksforgeeks.org/hibernate-lifecycle/) |
- [Hibernate Lifecycle](https://www.geeksforgeeks.org/hibernate-lifecycle/) |
||||||
- [Entity Lifecycle in Hibernate](https://www.javatpoint.com/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 Entity Lifecycle & and its state](https://www.baeldung.com/hibernate-entity-lifecycle) |
||||||
|
|
||||||
|
@ -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. |
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: |
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) |
- [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) |
- [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 |
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. |
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: |
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) |
- [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) |
- [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. |
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: |
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/) |
- [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) |
- [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. |
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: |
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/) |
- [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/) |
- [What is JPA, Spring Data and Spring Data JPA](https://www.amitph.com/jpa-and-spring-data-jpa/) |
||||||
|
|
||||||
|
@ -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 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. |
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: |
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) |
- [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) |
- [Spring Boot - Cloud Configuration Server](https://www.tutorialspoint.com/spring_boot/spring_boot_cloud_configuration_server.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 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: |
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) |
- [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) |
- [Simple Implementation of Spring Cloud OpenFeign](https://medium.com/javarevisited/simple-implementation-of-spring-cloud-openfeign-7f022630d01d) |
Loading…
Reference in new issue