Lagom with Spring

508 views Asked by At

Lagom by default uses Google Guice as implementation od DI pattern.

I would like to use Spring Framework instead.

Is it possible? IF so, how should it be done?

I have successfully integrated Akka with Spring (using hints from documentation and Internet), however I cannot find anything in documentation about integrating with Spring.

1

There are 1 answers

4
James Roper On BEST ANSWER

Possible? Yes. Will you be constantly swimming upstream, with reach upgrade break in new and unexpected ways requiring you to debug undocumented internal APIs? Most probably.

Lagom is built on Play, Play's DI support is ostensibly pluggable, when I wrote it I hacked together a proof of concept to ensure that Spring could be plugged into it. But it was only ever a proof of concept, neither I or the Play team ever had any desire or intention of maintaining it, so I published my work to GitHub:

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

So that anyone for whom Spring support was important could continue where I left off. That was 3 years ago. In spite of a community of over a hundred thousand developers, no one ever took the work up. There's not a lot of work to do on the module itself, where most of the work would be is in Play and Lagom to fix areas where they have grown incompatible with Spring.

But really, why do you want to use Spring? The whole Lagom and Play ecosystems are built on Guice, saying you want to use Spring with Lagom is like saying you want to use a narrow gauge train in a country that only has standard guage rails, you're going to have to build yourself an entire new rail system to do so. What do you hope to achieve?