0% found this document useful (0 votes)
7 views4 pages

L-7 - 8 - JBDL

The document outlines the advantages and principles of the Spring Framework, emphasizing modularity, separation of logic, and dependency injection (DI) as key features. It explains the concept of Inversion of Control (IOC), types of IOC containers, and various methods for injecting dependencies. Additionally, it covers bean lifecycle management, autowiring, stereotype annotations, and the use of Spring Expression Language, along with a brief overview of networking protocols and the MVC pattern.

Uploaded by

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

L-7 - 8 - JBDL

The document outlines the advantages and principles of the Spring Framework, emphasizing modularity, separation of logic, and dependency injection (DI) as key features. It explains the concept of Inversion of Control (IOC), types of IOC containers, and various methods for injecting dependencies. Additionally, it covers bean lifecycle management, autowiring, stereotype annotations, and the use of Spring Expression Language, along with a brief overview of networking protocols and the MVC pattern.

Uploaded by

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

Spring Framework:

Advantages of Spring Framework

1.​ Modularity
2.​ Separation of Logic between the different Layers
3.​ Security and authentication
4.​ Easy application development with less code
5.​ Make the application loosely coupled
6.​ Extensive support for Databases, Kafka , Redis etc.

IOC (Inversion of Control)


It's a design principle where the control of object creation and lifecycle is inverted or
moved away from the application code to an external framework or container. IOC is at
the heart of the Spring framework and is achieved primarily through dependency
injection (DI).

Dependency Injection
Dependency Injection (DI) is a design pattern and a fundamental concept in software
engineering where the dependencies of a component (i.e., an object) are provided from
the outside rather than created by the component itself. In simpler terms, instead of a
class creating its own dependencies, those dependencies are "injected" into the class
from an external source.

Advantages of IOC and DI

1.​ It Makes the application loosely coupled


2.​ DI separates the concerns of object creation and dependency resolution from the
business logic of the application

How the IOC Container works Internally.


Different Types of IOC Containers
Generally there are two IOC containers available in spring framework
1.​ Bean Factory
2.​ ApplicationContext

Ways of Injecting Dependencies


It can be done by using these types of injection
1.​ Setter Injection
2.​ Constructor Injection
3.​ Field Injection
4.​ Method Injection (NTCL)
Practical for injecting the data
1.​ Using the setter injection or property injection by using property tag
2.​ Using the constructor injection
3.​ Ambiguity with the constructor injection
4.​ Injecting the collections
5.​ Injecting the dependencies or Object in a class
6.​ Injecting the data by using the p-namespace
7.​ Injecting the data by using the c-namespace
8.​ Bean Inheritance with xml
9.​ Collections Merging
10.​Bean aliases
11.​Idref tag and working with references

Life Cycle of Bean


Generally Life cycle of a bean consists the two methods init() and destroy()
1.​ Implementing the methods using xml
2.​ Implementing the methods using interface - Initializing Bean, Disposable Bean
3.​ Implementing the methods using the annotations

Different Types of Bean


1.​ Singleton
2.​ Prototype
3.​ Session
4.​ Request
5.​ Globalsession
Working with Standalone collections
Learn How to use the util schema in the xml configuration

Autowiring
Autowired in Spring is a feature that allows the Spring container to automatically inject
dependencies into beans without explicit configuration. It helps to reduce boilerplate
code by handling the wiring of beans automatically, based on certain rules or
configurations.

Types of Autowiring

1.​ ByName
2.​ ByType
3.​ Constructor

Working with @Autowired and @Qualifier annotation


Advantages and Disadvantages of @Autowired annotation​
How to Autowire an interface - @Primary, @Resource, @Qualifier
Null Injections with autowired annotation

Stereotype Annotations
Stereotype - component,service, controller, repository,

Removing the XML file and Working with Java configuration


@Configuration @ComponentScan @Bean

Working with the properties file and read value using value
annotation
@PropertyResource @Value
@Named, @Inject, @Resource

BeanPostProcessor, BeanFactoryPostProcessors,

Spring Expression Language


1.​ Arithmetic Operators - @Value("#{45 + 1}")
2.​ Relational and Logical Operators - @Value("#{1 != 1}")
3.​ Logical Operators - @Value("#{250 > 200 and 200 < 4000}")
4.​ Conditional Operators - @Value("#{2 > 1 ? 'a' : 'b'}")
5.​ Accessing List and Map Objects -
@Value("#{className.mapName['keyName']}"),
@Value("#{className.listName[0]}")
6.​ Invoking the static methods of a class - #{T(className).method()}

TCP and UDP Protocol Explanation


Client-server architecture
HTTP and HTTPS protocol - Methods
REST and SOAP
HTTP Request and Response format
API - URL
Application vs Web servers​
Scalability
Explore Postman and CURL
Lombok Dependency
MVC Pattern overview

You might also like