-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathflow.txt
More file actions
45 lines (32 loc) · 833 Bytes
/
flow.txt
File metadata and controls
45 lines (32 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
@Entity
@Data
@NoArgsConstructor
class Todo {
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private Long id;
@NonNull
private String title;
private Boolean completed = false;
}
@RepositoryRestResource(collectionResourceRel = "todos", path = "todos")
interface TodoRepository extends JpaRepository<Todo, Long> {
}
@Slf4j
@RepositoryEventHandler(Todo.class)
class TaskEventHandler {
@HandleBeforeSave
public void handleBeforeSave(Todo todo) {
log.debug("Saving todo: {}", todo.getTitle());
if (todo.getCompleted()) {
log.info("This Todo is completed: {}", todo.getTitle());
}
log.debug("Completed saving todo: {}", todo.getTitle());
}
}
@GetMapping("/slow")
public String slowRequest() throws InterruptedException{
Thread.sleep(250);
return "ok";
}
<version>42.5.0</version>