Hi,
Currently I'm working on upgrading a Play 2.3 application to the latest 2.5 version. I use play in combination with spring for dependency injection and for example Spring Data and AMQP. I'm currently checking which kind of solution would fit best for the application since Guice has been introduced in Play 2.4 and it isn't that trivial anymore to combine Play with Spring.
Searching for a solution I found several nice approaches and focused on two of them.
- The first solution is build by Remi Thieblin and replaces Guice by Spring (https://github.com/remithieblin/play-spring-loader)
- The second solution is build by Eva Maciejko using Spring in combination with Guice (https://github.com/daxyonis/play25-java-spring)
First of all I'm glad that both Remi Thieblin and Eva Maciejko shared their solution and I was wondering what your experiences are with the choosen approaches and what your experiences are with either replacing Guice completely or combining it with Spring within a Java project.
My reflections on both solution untill now:
With the second approach and a stripped down version of my application I was able to start the Spring beans and use them via a static call in the Play controller (by looking them up in the spring context) using Spring for transaction management. Because I still need to do the complete migration I would like to here your thoughts on the best way to approach the migration and the experiences other user have with migrating a project with Spring dependencies to play 2.5.
Ofcourse it might also be possible to consider to completely migrate to Guice and try to integrate components like Spring data by alternatives for Guice.
Kind regards,
Jacco
--
You received this message because you are subscribed to the Google Groups "Play Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/7f1bfebf-71d7-4607-8b2a-15c3497e829d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/7f1bfebf-71d7-4607-8b2a-15c3497e829d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Greg,
I updated the project to use the latest play version 2.5.10 with Spring for DI and ran into the issue that there is a class play.api.inject.DefaultApplicationLifecycle which has a default constructor combined with the @Inject annotation. This leads to a problem creating a singleton bean within spring as it requires at least one argument when autowiring is used for constructor arguments.
play.api.UnexpectedException: Unexpected exception[IllegalStateException: Autowired annotation requires at least one argument: public play.api.inject.DefaultApplicationLifecycle()]
Is it neccessary for Play (Guice DI) to have the @Inject added to a default constructor or could this be changed in a later version of play so that Spring is also able to instantiate the DefaultApplicationLifecycle class?
Kind regards,
Jacco
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/d556a3ac-79be-45ba-b6b4-2e7b8a1adfed%40googlegroups.com.To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
@Inject
and accept zero or more dependencies as arguments" which is not what Spring does. I don't think that reporting a bug for the play-spring-loader is going to help as Spring itself is the problem here. I spent some time checking if it is possible to toggle an option within Spring to make it accept an autowired constructor without arguments but (for now) I didn't find such an option. I think I hit a real problem here with integrating Spring that is stopping me from completely replacing the DI with Spring unfortunately.To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/d556a3ac-79be-45ba-b6b4-2e7b8a1adfed%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/29a3724a-1298-45f3-93c5-2c1850520ea4%40googlegroups.com.To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/29a3724a-1298-45f3-93c5-2c1850520ea4%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/561ff33e-b3e0-425b-b585-d7ba5bd0a1c8%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/561ff33e-b3e0-425b-b585-d7ba5bd0a1c8%40googlegroups.com.
play.bindings.disabled += "play.api.libs.Crypto"
play.bindings.disabled += "play.libs.Crypto"
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/aab76b74-545c-4cc6-a526-befbf61887d7%40googlegroups.com.To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/aab76b74-545c-4cc6-a526-befbf61887d7%40googlegroups.com.
NoSuchMethodError: play.api.Environment$.simple$default$2()Lscala/Enumeration$Value;
->java.lang.NoSuchMethodError: play.api.Environment$.simple$default$2()Lscala/Enumeration$Value;
com.actimust.play.spring.SpringApplicationBuilder.<init>(SpringApplicationBuilder.scala:26)
com.actimust.play.spring.SpringApplicationLoader.<init>(SpringApplicationLoader.scala:16)
--
You received this message because you are subscribed to the Google Groups "Play Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/bcbd210e-318f-41dc-b91f-ade44ef4adac%40googlegroups.com.
play.modules.enabled += "com.demo.spring.MyModule" play.spring.configs = ["com.example.PlaySpringDIConfiguration"]
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/bcbd210e-318f-41dc-b91f-ade44ef4adac%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/d901209c-58a8-4c8f-a34e-e13e89eb5d37%40googlegroups.com.