我读到spring的主要用途是DI和AOP。
据我3周后对spring的了解,我感觉AOP可以在aspectj中完成 DI 并不是 Spring 特有的 API 技术。
所以我错过了什么。 spring只创建bean。
就是这个
最佳答案
I have read that the main uses of spring is DI and AOP.
以及两者附带的模块和库。在我看来,Spring 是一个三足凳。
As far as i understand spring in 3 weeks , i feel that AOP can be done in aspectj
当然,AOP 可以使用 AspectJ 来完成 - 只要您不介意字节码更改。您还可以使用 Spring 原始的 AOP,它使用代理并且侵入性较小。
and DI is technique not specific to spring with API's.
我不确定我是否理解你的观点。措辞不是很清楚。如果你的观点是 DI 可以在没有 Spring 的情况下完成,那么我会说你是对的。
so is i am missing anything. spring only creates beans.
我想说你错过了一切。
is that it
你还想让它做什么?
您更喜欢什么选择?
更新:
我不了解 PHP,但有一个用于 Python 的 Spring 版本:Spring.py。这对我来说意味着你当然可以在 Python 中同时进行 DI 和 AOP。我想说,它们在任何真正面向对象的语言中都是可能的。 DI 和 AOP 的思想就像任何其他 OO 模式一样:与语言无关。
关于java - java中spring框架的使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4914011/