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 88
99import javax .ws .rs .*;
1010import javax .ws .rs .core .MediaType ;
11+ import java .util .Collection ;
1112
1213@ Path ("/users" )
1314@ Component
@@ -16,6 +17,12 @@ public class UserResource {
1617 @ Autowired
1718 UserService userService ;
1819
20+ @ GET
21+ @ Produces (MediaType .APPLICATION_JSON )
22+ public Collection <User > getAll () {
23+ return userService .getAll ();
24+ }
25+
1926 @ POST
2027 @ Consumes (MediaType .APPLICATION_JSON )
2128 @ Produces (MediaType .APPLICATION_JSON )
Original file line number Diff line number Diff line change 99import org .springframework .stereotype .Service ;
1010import org .springframework .transaction .annotation .Transactional ;
1111
12+ import java .util .Collection ;
1213import java .util .Date ;
1314
1415@ Service
@@ -21,6 +22,10 @@ public class UserService {
2122 @ Autowired
2223 UserRepository userRepository ;
2324
25+ public Collection <User > getAll () {
26+ return userConverter .modelToResponse (userRepository .findAll ());
27+ }
28+
2429 public User save (final UserRequest userRequest ) {
2530 UserModel userModel = userConverter .requestToModel (userRequest );
2631
You can’t perform that action at this time.
0 commit comments