-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d6b8072
commit 6f03ebe
Showing
4 changed files
with
31 additions
and
31 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
package trutzio.devopstools; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.SequenceGenerator; | ||
|
||
@Entity | ||
public class Person { | ||
|
||
@Id | ||
String id; | ||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "person_id_seq") | ||
@SequenceGenerator(name = "person_id_seq") | ||
Long id; | ||
|
||
String name; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package trutzio.devopstools; | ||
|
||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class PersonController { | ||
|
||
private final PersonRepository personRepository; | ||
|
||
public PersonController(PersonRepository personRepository) { | ||
this.personRepository = personRepository; | ||
} | ||
|
||
@GetMapping("/") | ||
// @WithSpan(value = "test span") | ||
public String newPerson() throws InterruptedException { | ||
Person person = new Person(); | ||
person.name = "John Doe"; | ||
return personRepository.save(person).id.toString(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters