Spring 4 and Servlet 3.0
Ian Young
ian at iay.org.uk
Sun Dec 15 05:18:00 EST 2013
On 14 Dec 2013, at 19:40, Ian Young <ian at iay.org.uk> wrote:
> Spring Framework 4.x is dependent (at least for Mock classes used in tests, but probably elsewhere too) on Servlet 3.0
Some additional information on this, prompted by a side conversation with Chad.
The Spring team's statement on this is here:
https://github.com/spring-projects/spring-framework/wiki/Migrating-from-earlier-versions-of-the-spring-framework
> If you deploy your Spring application to a Java EE server, you should ensure that it is certified for Java EE 6 or above. Of particular importance are the JPA 2.0 and Servlet 3.0 specifications. That said, it is still possible to deploy a Spring Framework 4.0 application to a Servlet 2.5 container (e.g. Google App Engine, WebSphere 7, WebLogic 10.3); however, some Servlet 3.0 based Spring features won't be available.
This sounds like a road paved with good intentions, unfortunately. Internally, the Spring modules assume that the Servlet 3.0.1 API is <scope>provided</scope> in Maven terms. Once that is assumed, it's hard to see that it won't gradually infect the rest of the code base.
In our case, the presence of that "provided" dependency forces an update to two classes in java-support (ThreadLocalHttpServletRequestProxy and ThreadLocalHttpServletResponseProxy) in order to wrap the additional methods in HttpServletRequest. It's not clear to me what these are for, but they only appear to be used directly in tests. It's possible, therefore, that we might be able to move them to the test classes and wall off the use of Servlet 3.0 in that way. Then we'd have a nominal dependency on 3.0 but a real dependency only on 2.5 as Spring appears to. It feels like a rather brittle approach to me, though.
-- Ian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5943 bytes
Desc: not available
Url : http://shibboleth.net/pipermail/dev/attachments/20131215/036b057e/attachment.bin
More information about the dev
mailing list