Supporting Spring as an alternative to Guice?

207 views
Skip to first unread message

Remi Thieblin

unread,
Apr 29, 2016, 11:40:56 AM4/29/16
to Play framework dev
Hi,
I wanted to know if the Playframework team and community was interested in supporting Spring as an alternative to Guice. I've read a lot of the conversations about it on the mailing list, my understanding is that there was no plan for it, but I thought maybe if the community was working on it, maybe it would get some traction. 
I've been working on it for a while as a side project, but I'm running out of time so wanted to get a feeling of how likely such a PR would be accepted.
I've based my work off of the play-spring POC of James Roper. And re-used the loader and builder pattern used  for the Guice classes. A Play 2.6 app starts and runs with Spring as the DI. The code is here: 

I've started it because my company had a dependency on a spring dependent library, and we are stuck on Play 2.3 for this reason, and I thought maybe other people might have the same challenge.
Thanks
Remi

Greg Methvin

unread,
Apr 29, 2016, 11:39:46 PM4/29/16
to Remi Thieblin, Play framework dev
Hi Remi,

There is no plan for the Play core team to work on Spring integration, and I'm not aware of anyone else working on it. We know a decent number of users want a solution that's fully integrated with Play's module system, so I definitely think other people in the community would find it valuable, though.

I think it's best to release a separate library that provides the integration classes, such that someone using Spring can just install a SpringApplicationLoader and get everything working automatically.

I would suggest basing your work off of 2.5 just so you can make it available to existing users to try out. The DI integration is not likely to change much between 2.5 and 2.6, but other stuff might break in the 2.6 snapshots so I wouldn't recommend actually basing an app off it just yet.

If you need advice on specific problems you're having feel free to post questions to the mailing list.

Thanks,
Greg

--
You received this message because you are subscribed to the Google Groups "Play framework dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Greg Methvin
Senior Software Engineer

James Ward

unread,
May 2, 2016, 11:17:26 AM5/2/16
to Play framework dev
A while back I tried to tackle this, starting with James Roper's project:

I didn't make it very far but that might give someone a more recent starting point.

-James

Will Sargent

unread,
May 2, 2016, 6:44:46 PM5/2/16
to Remi Thieblin, Play framework dev
This is interesting and I think would help teams that are already familiar with Spring DI.

One thing to note is that although Play uses Guice as a default, Play is written so that all the internal DI used by Play is confined to a single package, play.api.inject.guice:


There is a bug open to break out the Guice dependency here into a plugin, the same way that has been done with Logback:


So it may make sense to set up a Spring plugin along the same lines -- that way Play doesn't have to have a dependency on Guice at all, and can use Spring DI and JSR 330 internally and externally.

Will.

On Fri, Apr 29, 2016 at 8:40 AM, Remi Thieblin <remi.t...@gmail.com> wrote:

--

Remi Thieblin

unread,
Jul 18, 2016, 11:51:26 AM7/18/16
to Play framework dev, remi.t...@gmail.com
Hi, following up, I just wanted to let you know that I've extracted the Spring Application loader code in it's own library. You can try it out in your Play application, instructions are in the readme:

It needs more tests, but hopefully it's a start and can help some people trying to use Play with Spring. I've been testing it mainly with my demo app here:
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework-dev+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Will Sargent

unread,
Jul 18, 2016, 2:34:16 PM7/18/16
to Remi Thieblin, Play framework dev
Hi Remi 

Thanks!  This looks really interesting.

You have a note in play24_spring saying that the name is inaccurate -- Github will let you rename your projects and will redirect URLs to the new location:


Hope that helps,
Will.

To unsubscribe from this group and stop receiving emails from it, send an email to play-framework-...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Greg Methvin
Senior Software Engineer

--
You received this message because you are subscribed to the Google Groups "Play framework dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages