I use Play Framework + Spring Data JPA from this example:
https://github.com/typesafehub/play-spring-data-jpa
I have models, repositories and now I want to initialize my DB on start up. I inject repositories to my Global.java file using @Autowired
, but they equals to null
on run time. It's because Spring don't try to inject dependencies to Global.java, because Global.java don't have even package name, so I can't tell Spring to scan his package!
With controllers Spring DI works well, but how to use it in Global.java? How to initialize database using repositories?