문제

My question is more conceptual, rather than practical. I have read about IoC and DI, and I think that I have understood those concepts (IoC is more general than DI, there are other ways to realize IoC). In all articles when one says IoC, it is mentioned frameworks like Spring, etc.

However, I did not see any where if JavaEE does make Inversion of Control, or not. So, I want to know this, to digest these concepts better.

I am not searching any pro's, con's, etc.

Simply:

JavaEE does also have DI, through CDI.

  • Is JavaEE considered as having IoC, or not?
  • Why?
  • If not, what does it lack to be considered like that?
도움이 되었습니까?

해결책

Dependency injection in IoC is not a feature of a language, rather it's a feature of a framework/platform/library. As such, DI present in JEE is a good example of inversion of control so yes, JEE "has" it.

You should understand, though, that DI is not the only technique of inversion of control. Another would be, for instance template method pattern.

Edit: This article seems to be a good overview of IoC in general and various flavours of it.

다른 팁

CDI is the technical name of JEE's IOC and is specified by JSR 299 : https://docs.oracle.com/javaee/6/tutorial/doc/giwhb.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top