playframework / playframework/play-samples
play-java-dagger2-example inject JPAApi
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 554
- Forks
- 548
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 57
Description
I am exploring the play-java-dagger2-example project. I tried to get JPAApi instance from MyComponentsFromContext like this:
JPAApi jpaApi = application().injector().instanceOf(JPAApi.class);
But this throws [NoSuchMethodException: play.db.jpa.JPAApi.<init>()]
What is the correct way to get JPAApi with Dagger 2?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the play-java-dagger2-example project and inspect MyComponentsFromContext, the Dagger 2 component setup, and the JPAApi injection path. Verify the approach against the shown application().injector().instanceOf(JPAApi.class) call; done means the example can obtain a JPAApi instance without the NoSuchMethodException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100