-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHomeController.java
More file actions
29 lines (23 loc) · 917 Bytes
/
Copy pathHomeController.java
File metadata and controls
29 lines (23 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.app.controller;
import com.app.exception.CustomException;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
public class HomeController {
@GetMapping
public ResponseEntity<String> home() {
return new ResponseEntity<>("Running.....", HttpStatus.OK);
}
@GetMapping("exception")
public ResponseEntity<String> exceptionTest(@RequestParam(required = false) Integer id) {
if (id == null) {
throw new CustomException("E0001", "Data Not found", HttpStatus.NOT_FOUND);
}
return new ResponseEntity<>("Running.....", HttpStatus.OK);
}
}