Spring 会支持 CDI 吗?

问题描述:

对于 Java 开发人员来说,Spring 是一个很好的 DI 和 AOP 框架.

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

现在,DI 和 AOP 有了一个标准规范,即 CDI.

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

任何好的产品,如果不支持相关标准,就不能再好.(例如Hibernate支持JPA规范)

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

我的问题是,Spring 是否会在其未来版本中支持标准规范 (CDI)?

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

尽管 Spring 是开源的,并得到了大型社区的使用和支持,但其未来的发展却是由一家公司(spring source/vmware)控制的.因此,它的决定本质上是非公开的,肯定会受到很多因素的影响——比如社区当前的需求,当然还有财务和政治方面(归根结底都是关于金钱的).

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).

因此,重要的是要得出结论,spring/spring source 不受任何官方流程的约束(例如 JCP),并且无法预见 spring source 将来会决定什么.另一方面,过去的行为导致假设 spring 源不是 - - 特别对实现完整的 CDI 堆栈 (JSR 299) 感兴趣.请记住,尽管 spring source 最初加入了 JSR 299 的 JCP(连同 sun、redhat、google 等),但他们都为此进行了一场可怕的斗争,导致了 JSR 330 的分支,这只是一个子集JSR 299.另外:在任何未来版本的 spring 中实现依赖注入的(有状态的)CDI 模型将是真正一堆工作.

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.

所以,长话短说:即使我们不知道未来,可以很安全地假设 spring/spring 源永远不会支持 JSR 299 作为一个整体,但坚持他们的 JSR 330 实现.

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.