Play-Framework 2.4: Use Spring Depedency Injection with Play-Framework Instead of Guice

后端 未结 3 1762
小鲜肉
小鲜肉 2021-01-21 00:13

I am using Spring-Depedency injection instead of Play-Framework Guice Depedency injection, because of our requirement, we need to use most of the

相关标签:
3条回答
  • 2021-01-21 00:38

    To integrate play with Spring application i given step by step how to develop. Click here

    0 讨论(0)
  • 2021-01-21 00:40

    May be a late answer for this question. Posting it for the benefit of future reference.

    I faced a similar challenge of using spring beans in Play 2.5.X. There is an api guice-spring provided by guice to integrate spring with guice injector. Using this api I was able to configure guice to fetch beans form my spring context for injection, especially my controller beans. Check this link to see how to bind a spring bean into guice.

    0 讨论(0)
  • 2021-01-21 00:45

    This answer will not solve your problem but I hope it will guide you how to overcome your problem using a different approach. First of all, I'm using Spring integrated in Play however, Spring uses an abstraction class and handles its own life cycle for now. Play (2.4.*) uses its default Guice injection support.

    For your problem, after my research I've found these links about replacing/integrating Spring's dependency injection with juice in Play 2.4. However, integration with Spring for Play 2.4 doesn't exist yet, there is only a prototype done by James Ropper as stated in this issue:

    github.com/playframework/playframework/issues/4665

    github.com/jroper/play-spring

    github.com/spring-projects/spring-guice

    0 讨论(0)
提交回复
热议问题