Spring Boot 프로젝트를 위한 공통 라이브러리입니다.
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.inhooo00:inho-kit:v0.0.1'
}repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
dependencies {
implementation("com.github.inhooo00:inho-kit:v0.0.1")
}의존성 추가만 하면 자동으로 활성화됩니다.
| 예외 | HTTP 상태 |
|---|---|
InvalidGroupException |
400 Bad Request |
AuthGroupException |
401 Unauthorized |
AccessDeniedGroupException |
403 Forbidden |
NotFoundGroupException |
404 Not Found |
ConflictGroupException |
409 Conflict |
제공되는 예외 클래스를 상속받아 사용합니다.
public class UserNotFoundException extends NotFoundGroupException {
public UserNotFoundException() {
super("사용자를 찾을 수 없습니다.");
}
}// 사용
throw new UserNotFoundException();응답 예시:
{
"type": "errors",
"title": "사용자를 찾을 수 없습니다.",
"status": 404,
"timestamp": "2025-02-27T12:00:00+09:00"
}@GetMapping("/users/{id}")
public ResponseEntity<RspTemplate<UserResponse>> getUser(@PathVariable Long id) {
UserResponse user = userService.findById(id);
return RspTemplate.<UserResponse>builder()
.statusCode(HttpStatus.OK)
.message("사용자 조회 성공")
.data(user)
.build()
.toResponseEntity();
}응답 예시:
{
"statusCode": 200,
"message": "사용자 조회 성공",
"data": {
"id": 1,
"name": "홍길동"
}
}- Java 17+
- Spring Boot 3.x
MIT License