Question

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?
Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top