formatting

This commit is contained in:
Guillaume Polaert 2017-08-01 13:33:45 +02:00
parent 97e7228ce6
commit 58ec657a05
2 changed files with 4 additions and 6 deletions

View File

@ -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> {}

View File

@ -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);
}