简体   繁体   English

玩! 2.x与Java 8和Spring依赖注入

[英]Play! 2.x with java 8 and spring dependency injection

I'm trying to use Play with java 8 and spring dependency injection. 我正在尝试将Play与Java 8和Spring依赖项注入配合使用。 The problem is that play (com.typesafe.play:play-java_2.10:2.2.2) depends on spring 3.2.3 and spring's full support for java 8 compile level (1.8) is intoduced in spring 4.0. 问题是play(com.typesafe.play:play-java_2.10:2.2.2)依赖于spring 3.2.3,而spring对java 8编译级别(1.8)的完全支持在spring 4.0中引入

If I use spring 3.2.3, I get the following exception when spring is trying to load the beans at app startup: 如果我使用spring 3.2.3,则当spring尝试在应用启动时加载Bean时,出现以下异常:

ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet

So my options are: 所以我的选择是:

  1. Not using spring and create singletons for my service and dao objects 不使用spring并为我的服务和dao对象创建单例
  2. Use guice or other frameworks for DI and I'm not sure about the compatibility of them with play dependencies either. 使用guice或其他DI框架,我也不确定它们与播放依赖项的兼容性。
  3. Not using java 8 features which is very unpleasant because I can't use lambda expressions which is very useful in Play's async scenarios. 不使用非常令人不快的Java 8功能,因为我不能使用lambda表达式,这在Play的异步场景中非常有用。

Do I have any other options? 我还有其他选择吗? mainly can I somehow make play work with spring 4? 我主要可以以某种方式使Play在Spring 4中工作吗?

And Is there any announced time for upgrading to spring 4 in Play's roadmap? 而且Play路线图中是否有宣布升级到Spring 4的时间?

You can use Play 2.3-M1! 您可以使用Play 2.3-M1! that depend on Spring 4 which Java 8 supported. 取决于Java 8支持的Spring 4。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM