Integrate Spring and Hibernate in Play Framework 2.1?

I need to create a web application integrating Spring and Hibernate in Play Framework 2.1. I integrated Hibernate successfully, but I don't know how to do this with Spring. Anynone can show me an example or a way to do this. Thanks for the advanced.

+5
source share
3 answers

It is very easy now in Play 2.1 with an interceptor getControllerInstance. Here is an example application that has Play 2.1, Spring (with Java Config), and JPA: https://github.com/jamesward/play2bars/tree/java-spring

+8
source

I recommend the answer from James Ward. Below is information on upgrading from Spring Java 2.0 play to version 2.1.

2.0.4 Spring4Play2, . https://github.com/scott-phillips/Spring4Play2/blob/master/README.markdown, 2.1.1, 2.1-SNAPSHOT https://maven.library.tamu.edu/content/repositories/snapshots/play/spring_2.9.1/2.1-SNAPSHOT/

, , - " [play.api.db.BoneCPPlugin] ". "java.lang.IncompatibleClassChangeError: play.api.Application, ", googling .

, ,

"org.springframework" % "spring -context" % "3.2.1.RELEASE",

Build.scala, https://github.com/jamesward/play2bars/blob/java-spring/project/Build.scala

Global.java, , .

, , .

0

spring ( Hibernate) Play 2, ( ) : http://serverbabyblog.wordpress.com/2014/03/26/activiti-on-play-2-with-spring-and-hibernate-jpa-example/

, "Activiti".

Basically, I was forced to throw out jpa and jdbc plugins Play !. Replacing their functionality with well-known third-party open source organizations. Everything is fine. Play The JPA plugin is too narrow for my case.

As a result, the transaction, managed by the spring transaction manager and the whole example, works with spring JPA annotations (using Hibernate JPA). This is truly a cross-platform example, because you can take all the spring stuff and move from the game to other frameworks.

Good luck

0
source

All Articles