hello jiniworld

hello jiniworld

  • hello jiniworld (218)
    • Spring (58)
      • Basic (15)
      • Spring Docs (6)
      • Spring Data JPA Tutorial (14)
      • Spring Boot Tutorial (17)
      • Jersey (6)
    • Go (17)
    • Dev (10)
      • Clean Architecture (3)
      • System Design (2)
      • Documents (2)
      • Client (2)
    • Infrastructure (5)
      • Docker (1)
      • Kubernetes (4)
    • DB (19)
      • MySQL (8)
      • MariaDB (9)
      • Oracle (1)
    • Java (52)
      • Basic (14)
      • coding test (27)
      • Effective Java (11)
    • Python (7)
      • Flask (1)
      • Basic (3)
      • Effective Python (1)
      • coding test (2)
    • Front-end (3)
      • Vanilla JS (2)
      • Basic (1)
    • Linux (11)
      • Basic (2)
      • Command-line (9)
    • Web Server (6)
      • CentOS 7 (5)
      • Oracle Linux 8 (1)
    • WAS (3)
    • CentOS 7 (17)
      • Basic (9)
      • Jenkins (8)
    • Etc (10)
      • Windows 10 (3)
      • trash bin (3)
05-14 19:11
  • 전체보기
  • 방명록
  • jini's GitHub
  • demo api
  • chaeking api
RSS 피드
로그인
로그아웃 글쓰기 관리

hello jiniworld

컨텐츠 검색

태그

codility JAX-RS https springboot Command-Line MariaDB Spring Boot hackerrank SpringBoot2 go week1 spring docs Jersey MySQL Java centos7 jenkins effectivejava Spring Boot Tutorial Spring

최근글

댓글

공지사항

  • SSL 인증서 설정하기

아카이브

hello jiniworld(218)

  • [Jersey] 3. WebApplicationException 상속 클래스를 이용한 Error Handling

    2022.05.12
  • [Jersey] 2. JPA 및 datasource 설정하기

    2022.05.11
  • [Jersey] 1. Jersey 프로젝트 생성하기

    2022.05.10
  • [JDK 14] Switch 문에서 arrow operator 이용하기

    2022.05.06
  • [JDK 16] Pattern Matching for instanceof

    2022.05.06
  • [JDK 9] Immutable Collection 생성하기

    2022.05.06
[Jersey] 3. WebApplicationException 상속 클래스를 이용한 Error Handling

Error Handling 의 필요성 적용하기 Response 클래스 Exception처리 클래스 정의 Service에 적용 결과 기본 제공 익셉션(WebApplicationException) 발생 시 InvalidRequestException 발생 시 1. Error Handling 의 필요성 기존에 만들었던 API에서, 조회할 수 없는 사용자를 조회했을 때 아래와 아무런 응답이 나오지 않습니다. Chrome DevTools를 열어보면, request는 실행되었다는 것을 확인할 수 있습니다. 저의 경우 204 HTTP status code와 함께 Response에 내용이 없이 도착했네요. 만일, 에러가 발생되었을 때 원하는 에러문구를 Response Body에 출력하고 싶고, 또 HTTP status ..

2022. 5. 12. 14:12
[Jersey] 2. JPA 및 datasource 설정하기

dependency 추가 datasource 설정 추가 User 엔티티 UserRepository 생성 Service 생성 Endpoint 생성 Endpoint 컴포넌트 등록 api 테스트 작업 중인 jersey 프로젝트에 DB를 연결해봅니다. spring boot에서 DB를 연동하는 방법은 매우 다양하지만, 이 프로젝트에서는 spring data jpa를 이용해서 DB 연동을 할 것입니다. JPA에 관련된 기본 설명은 이번 포스팅에서는 생략합니다. ※ 만일, JPA관련 기본 설정에 대해 궁금한 점이 있다면 Spring Data JPA Tutorial를 참고해주시기 바랍니다. build.gradle 에 spring data jpa 스타터와 연동할 DB인 MariaDB에 관련된 의존성 라이브러리를 추가할 ..

2022. 5. 11. 17:08
[Jersey] 1. Jersey 프로젝트 생성하기

JAX-RS? Jersey? Jersey 프로젝트 생성 Project 설정 Spring Boot 버전 및 Dependencies 추가 build.gradle에 lombok관련 dependencies 직접 추가 간단한 조회 API 테스트 프로퍼티 설정 Endpoint 설정 컴포넌트 등록 실행 결과 1. JAX-RS? Jersey? JAX-RX는 Java API for RESTful Web Services의 약자로, Java 플랫폼에서 경량화된 REST 웹 애플리케이션 구현을 지원하는 Java API 입니다. Jersey는 JAX-RS 요구사항에 맞게 구현된 프레임워크로, Spring MVC 보다 경량화 되어있어, api 정의가 매우 간결합니다. Spring Boot 에서는 jersey를 쉽게 이용할 수 있..

2022. 5. 10. 16:55
[JDK 14] Switch 문에서 arrow operator 이용하기

JDK 14 에서는 Switch 문에서 -> 를 이용하여 표현식을 간소화하는 것을 지원합니다. JEP 361: Switch Expressions 일반적인 switch 문에서는 아래와 같이 case문의 종료를 break로 정의해야했습니다. @Test void previous(){ List animals = Arrays.asList(Animal.CAT, Animal.CAT, Animal.LION, Animal.SNAKE, Animal.DUCK); animals.forEach(animal -> { int legs; switch (animal) { case CAT: case LION: legs = 4; break; case DUCK: System.out.println("오리는 꽥꽥"); legs = 2; bre..

2022. 5. 6. 15:44
[JDK 16] Pattern Matching for instanceof

JDK 16 부터 instanceof의 패턴 매칭을 지원합니다. 패턴 매칭은 타입을 강제로 설정해줌으로써 캐스팅을 잘못하여 발생되는 에러를 방지할 수 있습니다. JEP 394: Pattern Matching for instanceof instanceof 테스트를 하기 위해 먼저 아래와 같은 클래스를 선언했습니다. @Getter abstract static class Figure { protected String name; } @Getter static class Circle extends Figure { public Circle() { this.name = "원"; } } @Getter static class Square extends Figure { private final int line; publi..

2022. 5. 6. 14:36
[JDK 9] Immutable Collection 생성하기

Immutable Collection? JDK 9 버전 이전 moditable List 생성 예 - Arrays.asList immutableList List 생성 예 - Collections.unmodifiableList immutableList Set 생성 예 - Collections.unmodifiableSet JDK 9 버전 이후 List List.of List.copyOf Set Set.of Set.copyOf Map Map.of Map.copyOf Map.ofEntries 1. Immutable Collection? Immutable은 수정할 수 없는(=불변)을 뜻하는 말로, Immutable Collection을 다른 말로 표현하자면 읽기전용 컬랙션을 의미합니다. 어떤 데이터를 이용하고자 할..

2022. 5. 6. 11:51
1 ··· 12 13 14 15 16 17 18 ··· 37
JINIWORLD
© jiniworld. All rights reserved.

티스토리툴바