formatting
This commit is contained in:
parent
97e7228ce6
commit
58ec657a05
|
@ -5,5 +5,4 @@ import org.springframework.data.repository.CrudRepository;
|
|||
// This will be AUTO IMPLEMENTED by Spring into a Bean called userRepository
|
||||
// CRUD refers Create, Read, Update, Delete
|
||||
|
||||
public interface UserRepository extends CrudRepository<User, Integer> {
|
||||
}
|
||||
public interface UserRepository extends CrudRepository<User, Integer> {}
|
||||
|
|
|
@ -18,8 +18,8 @@ public class DBResource {
|
|||
private UserRepository userRepository;
|
||||
|
||||
@GetMapping(path = "/add") // Map ONLY GET Requests
|
||||
public @ResponseBody
|
||||
String addNewUser(@RequestParam final String name, @RequestParam final String email) {
|
||||
public @ResponseBody String addNewUser(
|
||||
@RequestParam final String name, @RequestParam final String email) {
|
||||
// @ResponseBody means the returned String is the response, not a view name
|
||||
// @RequestParam means it is a parameter from the GET or POST request
|
||||
|
||||
|
@ -37,8 +37,7 @@ public class DBResource {
|
|||
}
|
||||
|
||||
@GetMapping(path = "/get")
|
||||
public @ResponseBody
|
||||
User getUser(@RequestParam final int id) {
|
||||
public @ResponseBody User getUser(@RequestParam final int id) {
|
||||
// This returns a JSON or XML with the users
|
||||
return userRepository.findOne(id);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue