开发者

Dependency injection design pattern [duplicate]

开发者 https://www.devze.com 2023-01-24 11:46 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicate: What is dependency injection?
This question already has answers here: Closed 12 years ago.

Possible Duplicate:

What is dependency injection?

S开发者_开发百科pring uses dependency injection pattern. Can someone show a simple example of this pattern? I heard there is another pattern called service locator, which one is better?


Service locator is a J2EE "Core Patterns" idiom.

Let's define "better" before we debate it, shall we?

They aren't really competitors, IMO. Not every dependency happens over a network. Spring can do remoting and proxying, but that's not the sum of all dependencies.

0

精彩评论

暂无评论...
验证码 换一张
取 消