Just out of curiosity I want to know why does the spring 开发者_如何学编程releases comes with servlet 2.3 api and not with servlet 2.5 spec? I downloaded spring 3.0 and I see servlet 2.3 api.
I guess Spring 3.0 is compatible with servlet 2.3 onwards. You can always use newer version since Servlet specification is backward compatible.
E.g. when using maven simply add servlet 3.0 dependency explicitly (necessarily with provided
scope), it will override transitive 2.3 dependency.
You'll often see that Spring specifies dependencies on all manner of libraries, and that - a lot of times - in the framework itself, Spring uses reflection to invoke any of a multitude of APIs across a range of versions for a library. The lengths the framework goes to make it easy for you as the consumer in the face of inconsistent APIs is .. amazing.
It's one thing when the two APIs are different enough that they can be treated as two different imports, e.g., Hibernate 2 vs. Hibernate 3. But even among Hibernate 3.x versions, there are subtle API breaks that Spring knows about and works with. In Spring 3.1, there should be Hibernate 4 support, which is yet another drastically different API than Hibernate 2 or 3, so you can expect it'll support that version, too. Good thing most if Spring's dependencies are "optional" in the Maven descriptor!
By working with Spring's Hibernate 3 support, though, you get a sane, common interface no matter which Hibernate 3 impl you've got. So, if you see a situation where Spring specifies an old version of a stable API like the servlet spec, don't worry, it probably supports the newer versions, too. Spring 3.1 will more fully support servlet 3, for example.
精彩评论