Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will Spring support CDI? [closed]

Spring has been a good framework for DI and AOP for Java developers.

Now, there comes a standard specification for DI and AOP which is CDI.

Any good product can no longer stays good without supporting the relevant standards. (For example, Hibernate supports JPA specification)

My question is, will Spring support the standard specification (CDI) in its future releases?

like image 847
siva636 Avatar asked Aug 30 '11 03:08

siva636


People also ask

Does Spring support CDI?

Spring already supports CDI's javax.

Which injection is not supported by Spring?

There are three types of injection: Constructor, Setter and Interface. Spring doesn't support the latest directly(as I have observed people saying).

Would you recommend to use CDI or Spring annotations?

To summarize: CDI is nothing like a "replacement" for the Spring ecosystem, it's rather an improvement over Spring's dependency injection mechanism. It's part of Java EE 6, so if you are on a GlasFish with Java EE 6, you should definitely go for CDI.


1 Answers

Even though Spring is open source and used and supported by a large community, its future development is controlled by a single company (spring source / vmware). As such, its decisions are inherently non-public and certainly influenced by a large number of factors - like the currents demands of the community, but certainly also financial and political aspects (at the end of the day it's all about money).

So it's important to conclude that spring / spring source is not bound to any official process (such as the JCP would be) and one cannot foresee what spring source will decide in the future. On the other hand, past actions lead to the assumption that spring source is not - cough - specially interested in implementing the full CDI stack (JSR 299). Remember that even though spring source initially joined the JCP for JSR 299 (together with sun, redhat, google, ...), they all had a terrible fight about it which resulted in the fork of JSR 330, which is nothing but a subset of JSR 299. Plus: Implementing the (stateful) CDI model of dependency injection in any future version of spring would be a real bunch of work.

So, to make a long answer short: Even though we don't know about the future, it's pretty safe to assume that spring / spring source will never support JSR 299 as a whole, but stick with their implementation of JSR 330.

like image 137
Jan Groth Avatar answered Oct 20 '22 12:10

Jan Groth