Hi all,
I would like to use Play! together with "Spring Data - JPA" (formerly
known as hades)
(
http://www.springsource.org/spring-data/jpa )
in addition to the built-in Play! model-support.
I like the idea of having a DAO where I can call
===3<===
User user = userDao.findByEmail(username);
===3<===
instead of having to write
===3<===
User user = User.find("byEmail", username).first();
===3<===
However, I wasn't able to set up a simple testproject according to the
spring-data-jpa-examples-project:
https://github.com/SpringSource/spring-data-jpa-examples
I am using the current spring-module for Play. My dependencies.yml
looks like this:
===3<===
require:
- play
- play -> spring 1.0.2
- org.springframework.data -> spring-data-jpa 1.0.1.RELEASE
repositories:
- jboss:
type: iBiblio
root: "
http://eclipse.ialto.com/rt/eclipselink/maven.repo/"
contains:
- org.eclipse.persistence -> *
===3<===
I use a minimal application-context.xml:
===3<===
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://
www.springsource.org/dtd/spring-beans-2.0.dtd">
<beans>
</beans>
===3<===
Then I adapted
https://github.com/SpringSource/spring-data-jpa-examples/blob/master/spring-data-jpa-example/src/test/java/org/springframework/data/jpa/example/repository/UserRepositorySample.java
like this:
http://pastebin.com/g3eBNRAi
So that it yields a minimal Test for use with Play.
When running the test I get NullPointerExceptions in Lines 26 and 38
of the test. It seems as if the autowiring does not work.
When setting "play.spring.component-scan=true" I get a
BeanDefinitionStoreException:
===3<===
Oops: BeanDefinitionStoreException
An unexpected error occured caused by exception
BeanDefinitionStoreException: I/O failure during classpath scanning;
nested exception is java.io.FileNotFoundException: /home/foo/
playframework/springtest/precompiled/java/helpers/CheatSheetHelper
$1.class (File or directory not found)
===3<===
Which makes me wonder because there is no "precompiled" folder inside
my project-directory anyways.
I can't get rid of the feeling that I missed something...
I really hope that it is possible to use Play! together with spring-
data-jpa and that someone could provide a minimal Play!-project using
spring-data-jpa as an example.
Additionally any hint for a possible solution would be greatly
appreciated.
Thanks & Kind regards