Integrating Play framework 2.0 and Spring framework

与世无争的帅哥 提交于 2019-12-03 06:55:55

问题


I have developed a Spring/JPA application: the service, repository and domain layers are nearing completion.

The only layer that is missing is the web layer. I am considering using Playframework 2.0 for the web layer but I am not sure whether I can inject/use spring beans in my Playframework 2.0 classes.

Is this possible? If so how?


回答1:


You can. Updated for Play 2.5.x:

https://github.com/remithieblin/play-spring-loader




回答2:


Alex.p is right there is support for spring in PlayFramework

Have a look here : http://typesafe.com/blog/announcing-play-framework-21-the-high-velocit

and on example here : https://github.com/guillaumebort/play20-spring-demo

Cheers

I just tested it on my project it works but on playframework 2.1 in 2.0 it didn't work.




回答3:


Here is a another way of injecting beans using Spring. Standard annotations are used. No plugin is required.

https://github.com/huntc/play-spring




回答4:


See http://spring-webservice-2-step-by-step.blogspot.in/2013/12/spring-framework-integration-with-play.html

This is an example of spring play integration




回答5:


There's already support for the Spring IoC container in Play. It's just a matter of editing the application.conf file as mentioned in the linked to article.

Ignore the above see comment: it seems that this was dropped in playframework 2.0.



来源:https://stackoverflow.com/questions/9703714/integrating-play-framework-2-0-and-spring-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!