Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 733 Bytes

README.md

File metadata and controls

32 lines (26 loc) · 733 Bytes
@RequestMapping("/api/v1/users")
@Validated
public class UserController {
 
    private final UserService userService;
 
    public UserController(@Qualifier("userService") UserService userService) {
        this.userService = userService;
    }
 
    @GetMapping("/{userId}")
    public ResponseEntity<User> getUser(@PathVariable String userId) {
        return return userService.getUser(userId)
                .map(user -> new ResponseEntity<>(new User(), HttpStatus.FOUND))
                .get();    
    }
}

@Service
public class UserService {
    public Optional<User> getUser(String userId) {
        return Optional.empty();
    }
}

public class User {
    @NotEmpty
    private String userId;
}