你怎么能在Play里面使用Groovy!框架,模板之外? [英] How can you use groovy inside Play! Framework, outside of templates?

查看:189
本文介绍了你怎么能在Play里面使用Groovy!框架,模板之外?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

常见问题解答指出


是否使用Groovy框架?

没有。即使我们使用Groovy作为Play
模板系统的基础技术,它也是完全透明的。此外,您不能直接在Groovy中直接写入应用程序的任何其他部分(例如控制器,
模型或其他实用程序)的
。如果你正在寻找一个基于Groovy
的框架,你应该看看Grails。


虽然我知道它是不支持开箱即用,我相信/希望整合是可能的......我的意思是,毕竟Java是图灵完成:)

那么,有没有人试验过在编写Groovy代码,并从Play中调用该代码!控制器?什么是最好的实现方式?



奖励积分:如果解决方案与IntelliJ无缝配合,那就是天堂。

解决方案

如文档中所述,Play不是Groovy框架。是普通的java,我没有意识到在Play中使用Groovy的任何主动性。

另外,奖金点Play2完全删除了Groovy,即使在模板中也会被Scala取代。所以我认为,即使存在解决方案,未来也可能不会维护。

The FAQ states

Is play a Groovy framework?

No. Even if we use Groovy as the base technology for the Play templating system, it’s totally transparent. Also, you can’t write directly any other part of the application (such as controllers, models or other utilities) in Groovy. If you’re looking for a Groovy based framework you should have a look at Grails.

While I get that it's not supported out of the box, I do believe/hope the integration is possible ... I mean, Java is Turing Complete after all :)

So, has anyone experimented in writing Groovy code, and calling that code from Play! Controllers? What's the best way to achieve that?

Bonus points: If the solution worked seamlessly with IntelliJ, that would be heaven.

解决方案

As said in the documentation, Play is not a Groovy framework. Is is plain java and I am not aware of any initiative of using Groovy in Play.

Plus, bonus point, Play2 has completly removed Groovy even in templates to be replaced by Scala. So I think that even if a solution exists it might not be maintained in the future.

这篇关于你怎么能在Play里面使用Groovy!框架,模板之外?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆