Sei sulla pagina 1di 8

4/19/2020 What is dependency injection and what are the advantages?

SIMPLIFYING SEARCH

THE
PROGRAMMING
CONCEPTS
Pages

Home

What is
dependency
injection and
what are e
advantages?

March 28, 2020

D
SHARE
ependency

injection is

https://www.consciousprogramming.com/2020/03/what-is-dependency-injection-and-what.html 1/8
4/19/2020 What is dependency injection and what are the advantages?

Labels
a design pattern
Spring
that promotes loose
Spring 5.0 Certi cation

coupling between Spring 5.0 Certi cation Exam preparation

Spring IOC
the Spring

components – that

is, between the

different

collaborating
POJOs. So by

applying DI to your
complex
programming, your

code will become


simpler, easier to

understand, and
easier to test.

According to the DI
pattern, dependent
objects are given

their dependencies
at the time of the

creation of the
objects by some
factory or third

party. This means


that we have to
https://www.consciousprogramming.com/2020/03/what-is-dependency-injection-and-what.html 2/8
4/19/2020 What is dependency injection and what are the advantages?

focus on de ning
the dependencies
instead of resolving

the dependencies of
collaborating

objects in the
enterprise
application

https://martinfo

wler.com/article

s/injection.html

#InversionOfCont

rol

Inversion of control is

a common

characteristic of

frameworks that

facilitate injection of

dependencies. And

the basic idea of the

dependency injection

pattern is to have a

separate object that

injects dependencies

https://www.consciousprogramming.com/2020/03/what-is-dependency-injection-and-what.html 3/8
4/19/2020 What is dependency injection and what are the advantages?

with the

required behavior,

based on an interface

contract.

Advantages of
Dependency
Injection
• Reduced coupling

between the parts


of an application.
 • Increased
cohesion of the
parts of an

application.
• Increased
testability.
• Better design of
applications when

using dependency
injection.
• Increased
reusability.
• Increased

maintainability.
https://www.consciousprogramming.com/2020/03/what-is-dependency-injection-and-what.html 4/8
4/19/2020 What is dependency injection and what are the advantages?

• Standardizes
parts of application

development.
• Reduces
boilerplate code.
 No code needs to

be written to
establish
relationships in
domain classes.
Such code or

con guration is
separated into XML
or Java
con guration
classes. 

LABELS: SPRING,
SPRING 5.0
CERTIFICATION,

SPRING 5.0
CERTIFICATION
EXAM
PREPARATION,

SPRING IOC

SHARE
Comments

https://www.consciousprogramming.com/2020/03/what-is-dependency-injection-and-what.html 5/8
4/19/2020 What is dependency injection and what are the advantages?

Enter your comm

Popular posts from this blog

Java
SE 8
Progra
mmer
1
Certi
cation
Exam
topics(
OCA
Java
8)
December 14,
2019

https://www.consciousprogramming.com/2020/03/what-is-dependency-injection-and-what.html 6/8
4/19/2020 What is dependency injection and what are the advantages?

Java

Basics De n

e the scope
of …

SHARE
POST A
COMMENT
READ MORE

Design
philoso
phy of
Spring
Frame
w k
April 11, 2020

Spring helps
to defer

design

decision as…

SHARE
POST A
COMMENT

https://www.consciousprogramming.com/2020/03/what-is-dependency-injection-and-what.html 7/8
4/19/2020 What is dependency injection and what are the advantages?

READ MORE

Archive

Labels

Report Abuse

Powered by Blogger

https://www.consciousprogramming.com/2020/03/what-is-dependency-injection-and-what.html 8/8

Potrebbero piacerti anche