Похожие чаты

About reason number 3 i does not care which implemention

is used in any way because
if i use DI or not is the same because i using the implemention of the interface so it does not matter how i do it

in the DI way:
@AutoWired
@Qualifier("someImpl")
Interface inter;

abd if i want to change:
@AutoWired
@Qualifier("otherImpl")
Interface inter;

right?

the regular way:
Interface inter = new Impl();

if i want to change:
Interface inter = new Other();

so what are the differences???

1 ответов

16 просмотров

Well, in this situation DI vs non-DI may look similar. But there are other examples in which non-DI approach sucks. For example, what if you have to deal with conditionally created beans, i.e. in your development environment you use one implementation and in production you want to use another. Or what if you had only one implementation of something in your application but then decided to switch to something cooler which implements the same interface. And this "something" is used allover your application. If you didn't have DI, then you'd have to go through all of your components to switch to new dependency. However if you did have DI then you would need to replace the old dependency only in one place

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта