On Thu, Mar 8, 2012 at 12:58 PM, Caldarale, Charles R <chuck.caldar...@unisys.com> wrote: >> From: David Wahler [mailto:dwah...@indeed.com] >> Subject: Tomcat 5.5 JDK version compatibility > >> Does this mean that if a web application is deployed in Tomcat 5.5, >> it may not use any language features that were introduced in J2SE >> 5.0 or later (e.g. annotations and generics), even if those features >> are supported by the JRE? > > It's not the JRE that's the issue, it's the servlet spec version that your > webapp is claiming compliance with. Annotations don't appear there until 2.5 > (if I remember correctly). Generics will likely work, because there's > nothing in the servlet spec related to those.
True, neither annotations nor generics are mentioned in the servlet 2.4 spec, but both are supported at the language level by JRE/JDK 5 and up. In particular, my test case refers to @javax.annotation.Resource, which is part of J2SE 6 and understood by dependency-injection frameworks like Spring and Guice. But as per Servlet 2.5, that annotation is also interpreted by Tomcat 7 and used to inject JNDI dependencies. My expectation was that Tomcat's annotation processing would only happen if web.xml referred to version 2.5 of the spec or later. Hence the question: does the fact that annotations are a Java 5 feature automatically make a webapp that uses them non-compliant with servlet spec 2.4? (Mark seems to be assuming that I compiled my test case against Tomcat 7 APIs and then tried to deploy the resulting app with Tomcat 5.5, which isn't the case.) -- David --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org