File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
src/main/java/com/github/adamzink/springbootmysqldemo Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 8
8
9
9
import javax .ws .rs .*;
10
10
import javax .ws .rs .core .MediaType ;
11
+ import java .util .Collection ;
11
12
12
13
@ Path ("/users" )
13
14
@ Component
@@ -16,6 +17,12 @@ public class UserResource {
16
17
@ Autowired
17
18
UserService userService ;
18
19
20
+ @ GET
21
+ @ Produces (MediaType .APPLICATION_JSON )
22
+ public Collection <User > getAll () {
23
+ return userService .getAll ();
24
+ }
25
+
19
26
@ POST
20
27
@ Consumes (MediaType .APPLICATION_JSON )
21
28
@ Produces (MediaType .APPLICATION_JSON )
Original file line number Diff line number Diff line change 9
9
import org .springframework .stereotype .Service ;
10
10
import org .springframework .transaction .annotation .Transactional ;
11
11
12
+ import java .util .Collection ;
12
13
import java .util .Date ;
13
14
14
15
@ Service
@@ -21,6 +22,10 @@ public class UserService {
21
22
@ Autowired
22
23
UserRepository userRepository ;
23
24
25
+ public Collection <User > getAll () {
26
+ return userConverter .modelToResponse (userRepository .findAll ());
27
+ }
28
+
24
29
public User save (final UserRequest userRequest ) {
25
30
UserModel userModel = userConverter .requestToModel (userRequest );
26
31
You can’t perform that action at this time.
0 commit comments