Skip to content

I cannot seem to make dependency injection work #4599

Answered by graemerocher
nomemory asked this question in Q&A
Discussion options

You must be logged in to vote

Micronaut Launch is a great reference for how to get setup properly and get your application correctly configured.

  1. Create the project
$ mn create-app jpa-example --features data-jpa
$ cd jpa-example

or

$ curl https://launch.micronaut.io/jpa-example.zip?features=data-jpa -o  jpa-example.zip
$ unzip  jpa-example.zip -d  jpa-example
$ cd jpa-example
  1. Create en entity:
touch src/main/java/jpa/example/Person.java

Modify content to:

package jpa.example;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

@Entity
class Person {
    @Id
    @GeneratedValue
    private Long id;
    private String name;

    public Long getId() {
        return 

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by nomemory
Comment options

You must be logged in to vote
4 replies
@graemerocher
Comment options

@nomemory
Comment options

@graemerocher
Comment options

@nomemory
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants