본문 바로가기 메뉴 바로가기

Practical Accumulation

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

Practical Accumulation

검색하기 폼
  • 분류 전체보기 (423)
    • 광고 (0)
    • 업무 폴더 (0)
    • Demos (40)
      • 민원신청 SPA (0)
      • Email Client (14)
      • Shopping mall (9)
      • Football Club (12)
    • Languages (25)
    • Spring (185)
      • Hibernate (27)
      • Spring Basic (45)
      • Spring Security (15)
      • Spring AOP (12)
      • Spring REST (23)
      • Spring Advanced (18)
      • Spring Boot (26)
      • Spring Test (16)
      • Microservice (3)
    • Client Technologies (61)
      • Angular (30)
      • React (19)
      • Bootstrap (9)
      • Thymeleaf (3)
    • Side Technologies (46)
    • Basic (13)
      • Algorithms (10)
      • Data Structure (2)
    • Embedded Systems (2)
    • IT 관련 유용한 것들 (4)
    • 기록 (43)
  • 방명록

Spring/Spring REST (23)
Spring : REST + Hibernate with Java Config - CRUD 서비스 서버 구현

1. 앞의 포스트 내용을 기반으로 CRUD를 수행하는 서비스를 구현한다. 1-1 데이터베이스 구조가 동일한 이 포스트를 참조한다. Spring : Web MVC + Hibernate - 설정하기 -1. 예제를 위해 Customer 테이블을 생성한다. -1-0 사용자 springstudent를 만들고 암호도 springstudent를 생성한다. -1-1 web_customer_tracker라는 데이터베이스를 생성한다. -1-2 Customer 테이블을 생성한다.. kogle.tistory.com 2. webapp archetype 1.4를 사용하여 프로젝트를 생성한다. 2-1 web.xml 삭제 하고 index.jsp삭제한다. 2-2 .settings 폴더의 xml에 servlet 4.0을 설정한다. 2-..

Spring/Spring REST 2020. 5. 22. 01:15
Spring : REST 전역 예외 처리

1. 직전 포스팅은 각각 Controller에 대한 예외처리만 가능하였다. 2. 전역적으로 예외처리를 하려면 별도의 클래스를 생성한다. 2-0 클래스에 @ControllerAdvice를 붙여 Controller에 대한 AOP처리임을 명시한다. 2-1 여기로 모든 예외 처리 코드들 모두 옮겨와서 정리한다. 3. 주의할 점은 이 전역 예외 처리는 @Controller를 수식한 컨트롤러에서 발생한 예외만 처리한다는 점이다. package pe.pilseong.restbasic.rest; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bin..

Spring/Spring REST 2020. 5. 21. 15:28
Spring : REST 컨트롤러 예외처리

1. 직전 포스팅의 프로그램은 studentId가 범위를 벋어나는 경우 오류를 뿜어낸다. 2. 범위 뿐 아니라 숫자 대신에 문자를 입력하는 경우도 마찬가지이다. 3. 이런 오류를 정리된 형식의 Json형식으로 보내 싶으면 예외처리를 하면 된다. 3-1 우선 모든 예외를 받는 메소드를 하나 생성한다. @RestController @RequestMapping("/api") public class StudentController { ... @ExceptionHandler public ResponseEntity errorHandling(Exception e) { StudentErrorResponse response = new StudentErrorResponse(); response.setStatusCode(H..

Spring/Spring REST 2020. 5. 21. 15:26
Spring : REST - @PathVariable 사용하기

1. 이 포스트는 http://localhost:8080/rest-test/api/students/{ variable } 형식의 요청을 처리한다. 1-1 { } 안의 변수를 PathVariable이라고 하고 이 값을 받아서 내부적으로 처리 할 수 있디. 2. RestController를 다음과 같이 수정한다. package pe.pilseong.rest_test.restcontroller; import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.we..

Spring/Spring REST 2020. 5. 21. 01:32
Spring : REST - Collection 객체 전송하기

1. 이전 포스트에 약간 추가하여 Student List를 보내는 예제다. 1-1 여기에는 POJO객체가 사용되므로 lombok을 사용한다. org.projectlombok lombok 1.18.12 provided 2. 사용자는 webroot/api/students GET 요청을 보내면 REST api는 모든 학생 정보를 돌려준다. 2-1 Spring REST도 Dispatcher서블릿 앞에서 프록시처럼 동작하는데 2-2 요청을 받고 데이터 변환하는 역활을 Spring REST가 jackson을 사용하여 자동을 해준다. 3. 학생 클래스를 생성한다. package pe.pilseong.rest_test.entity; import lombok.Data; import lombok.NoArgsConstruc..

Spring/Spring REST 2020. 5. 21. 01:16
Spring : REST - 기초

1. REST의 가장 일반적인 사용은 Http 프로토콜을 통해서 이다. 2. HTTP 프로토콜의 CRUD를 활용한다. POST(create)/ GET(read)/ PUT(update)/ DELETE(delelet) 3. Rest API 테스트나 api 제공 사이트 1. https://www.jsontest.com/ 2. https://www.programmableweb.com/ 3. https://jsonplaceholder.typicode.com/ 4. 스프링에서 REST 지원은 Web MVC라이브러리가 같이하고 있다. 4-1 스프링 webmvc는 @RestController를 지원하고 있고 Rest요청을 처리한다. 4-2 전 포스트에서 언급한 대로 jackson data bind가 dependency..

Spring/Spring REST 2020. 5. 21. 00:57
Spring : 기본적인 REST Controller

0. Rest를 구현할 때 지금까지 설정했던 의존성만 있으면 된다. 별도의 module은 필요없다. 0-1. 기본적인 구현을 위해서는 지금까지 import한 Spring Web, Spring Data Jpa, mysql 가 필요하다. 1. @Controller 대신 @RestController 사용한다. 2. @ Mapping annotation으로 바인딩 할 때 @PathVariable로 처리한다. @GetMapping("/{id}") public Location getLocation(@PathVariable("id") Long id) { return this.locationRepository.findById(id).get(); } @DeleteMapping("/{id}") public void del..

Spring/Spring REST 2020. 4. 26. 08:45
이전 1 2 3 다음
이전 다음
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
  • 도커 개발환경 참고
  • AWS ARN 구조
  • Immuability에 관한 설명
  • 자바스크립트 멀티 비동기 함수 호출 참고
  • WSDL 참고
  • SOAP 컨슈머 참고
  • MySql dump 사용법
  • AWS Lambda with Addon
  • NFC 드라이버 linux 설치
  • electron IPC
  • mifare classic 강의
  • go module 관련 상세한 정보
  • C 메모리 찍어보기
  • C++ Addon 마이그레이션
  • JAX WS Header 관련 stackoverflow
  • SOAP Custom Header 설정 참고
  • SOAP Custom Header
  • SOAP BindingProvider
  • dispatcher 사용하여 설정
  • vagrant kvm으로 사용하기
  • git fork, pull request to the …
  • vagrant libvirt bridge network
  • python, js의 async, await의 차이
  • go JSON struct 생성
  • Netflix Kinesis 활용 분석
  • docker credential problem
  • private subnet에서 outbound IP 확…
  • 안드로이드 coroutine
  • kotlin with, apply, also 등
  • 안드로이드 초기로딩이 안되는 경우
  • navigation 데이터 보내기
  • 레이스 컨디션 navController
  • raylib
TAG
  • WebMvc
  • one-to-one
  • mapping
  • 로그인
  • 외부파일
  • Many-To-Many
  • 하이버네이트
  • 스프링부트
  • form
  • jsp
  • 상속
  • MYSQL
  • Spring
  • XML
  • 설정
  • RestTemplate
  • spring boot
  • 스프링
  • Validation
  • Security
  • Angular
  • crud
  • 설정하기
  • one-to-many
  • login
  • 자바
  • hibernate
  • Spring Security
  • 매핑
  • Rest
more
250x250

Blog is powered by Tistory / Designed by Tistory

티스토리툴바