使用 Spring 和 JDK 从 JDK6 迁移到 JDK7 时遇到的任何问题雄猫?
我想利用 JDK7 的一些功能。如果我使用 Apache Tomcat 7.0.x(最新)和 Spring 3.1(最新),我可能会遇到哪些问题?
I'd like to take advantage of some JDK7 features. What issues might I run into given that I use Apache Tomcat 7.0.x (latest) and Spring 3.1 (latest)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有一些编译问题,JDK 6 可以正确推断泛型类型,而 JDK 7 则不能。这显然是 JDK 6 中的一个错误,如此处< /a>.
如果您正在使用特定于容器的资源(例如,数据源等),请务必验证这些资源是否仍然正常运行(尽管如果其中任何一个已连接,这在 Spring 启动时会立即显而易见)。
如果您使用 Spring Security 并且升级,则无需进行任何更改本身即可运行。但是,您应该利用 Spring Security 3.1 中提供的不太详细的配置选项(尤其是 REST URL)。
除此之外,我们的升级是无缝的。
There were a few compilation gotchas where JDK 6 could infer the generic type properly where JDK 7 could not. This was apparently a bug in JDK 6 as referenced here.
If you are using container-specific resources (e.g., data sources, etc.) be sure to verify these are still operating properly (though this will be immediately obvious on Spring startup if any of these are wired in).
If you are using Spring Security, and you upgrade, you do not need to make any changes per se to get get things running. However, you should take advantage of their less verbose configuration options (especially for REST URL's) that are available in Spring Security 3.1.
Other than that, our upgrade was seamless.
在上次 Ubuntu 更新 (11.10) 中,我切换到了 JDK 7 (OpenJDK 1.7.0_147)。我在服务器上使用 Spring 3.0、Tomcat 6 和 JRE 6(我们同时安装了 VM 和“物理”服务器)。使用 JDK 7 编译的代码在此配置上运行没有任何问题。我确信,切换到 Spring 3.1 不会造成任何变化。关于 Tomcat 7 不太确定,但希望这些信息对您有用。
With the last Ubuntu update (11.10) I switched to JDK 7 (OpenJDK 1.7.0_147). I'm using Spring 3.0, Tomcat 6, and JRE 6 on the server (we have both VM and "physical" server installations). The code, compiled with JDK 7 runs on this configuration without any problems. I'm sure, switching to Spring 3.1 won't cause any changes. Not so sure about Tomcat 7, but hopefully this information will be useful to you.
如果您在 JSP 中使用 Java 7 功能,则可能会遇到问题。 Tomcat默认使用Java 1.6进行JSP编译。请参阅 http://tomcat.apache.org/tomcat -7.0-doc/jasper-howto.html#Production%20Configuration
要解决该问题,您需要覆盖
compilerSourceVM
和应用程序的 web.xml 文件中的compilerSourceVM
初始化参数。更多相关信息:https://stackoverflow.com/a/20194823/1029261You might run into a problem if you're using Java 7 features in a JSP. Tomcat by default user Java 1.6 for JSP compilation. See http://tomcat.apache.org/tomcat-7.0-doc/jasper-howto.html#Production%20Configuration
To solve the problem you'll want to override the
compilerSourceVM
andcompilerSourceVM
init parameters in your application's web.xml file. More on that here: https://stackoverflow.com/a/20194823/1029261