Spring-Data-Mongodb depedencies not picked by Play-Framework 2.4

吃可爱长大的小学妹 提交于 2019-12-01 23:08:17

To use the repository feature in Spring Data, the life cycle has to be managed by Spring.

Hence using it with Play 2.4 / 2.5, without adding Spring as a dependency is a problem because the default life cycle is managed by Guice.

I figured out a way to create the Spring beans and transfer its life cycle management to Guice. Hence they can be injected anywhere in the project by Guice instead of Spring.

For other components that don't have any Spring specific feature, they can be created normally and their life cycle will be managed by Guice.

For other components, which are Spring specific and can only run inside a Spring container, they can also be injected in the project and their life cycle will managed by Guice.

I modified the starter project included in Play 2.5 docs to demonstrate it.

Please have a look at this repository.
https://github.com/mohitsinha/play-java-spring-data-mongodb

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