Похожие чаты

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 ответов

13 просмотров

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

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

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

30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
Чёт не понял, я ж правильной функцией воспользовался чтобы вывести отладочную информацию? но что-то она не ловится
notme
18
Привет)) уже кажется эту тему перемусолили, но вот я так и не понял. Я сейчас сижу на 27дюймов 2к мониторе. На Актуальной макоси, если я куплю 27д 4к монитор: - будет ли изобр...
Vladislav Piskunov
16
Also, why can’t the community have a vote/ say when it comes to initiatives like buybacks. Isn’t the point of crypto decentralisation? Don’t we deserve input as long term supp...
👨🏽‍🦰
13
any reference of this implementation?
BitBuddha
29
Страшнейшая правда про списки ЦБ. С первых дней жизни P2P сферы, молодые человеки, начитавшись законодательной базы и "внутренних" документов, решили, что им противостоит сер...
Foxcool
3
У меня есть функция где происходит это: write_bit(buffer, 1); write_bit(buffer, 0); write_bit(buffer, 1); write_bit(buffer, 1); write_bit(buffer, 1); w...
~
14
Hi guys, any problem with Pulsebrige? Trying to transfer from wETH to ETH. First it tells me to connect my metamask "through mobile app" not desktop. Then I did and confirmed ...
Snowflakecrypto
13
Карта сайта