Skip to Content
처음부터 제대로 배우는 스프링 부트
book

처음부터 제대로 배우는 스프링 부트

by 마크 헤클러, 오시영, 서정대
May 2023
Beginner to intermediate
384 pages
8h 42m
Korean
Hanbit Media, Inc.
Content preview from 처음부터 제대로 배우는 스프링 부트
77
4
데이터베이스 액세스
@PostMapping
Coffee postCoffee(@RequestBody Coffee coffee) {
return coffeeRepository.save(coffee);
}
@PutMapping("/{id}")
ResponseEntity<Coffee> putCoffee(@PathVariable String id,
@RequestBody Coffee coffee) {
return (!coffeeRepository.existsById(id))
? new ResponseEntity<>(coffeeRepository.save(coffee),
HttpStatus.CREATED)
: new ResponseEntity<>(coffeeRepository.save(coffee),
HttpStatus.OK);
}
@DeleteMapping("/{id}")
void deleteCoffee(@PathVariable String id) {
coffeeRepository.deleteById(id);
}
}
애플리케이션이 예상대로 작동하니, 동작 결과가 코드 리팩터링 전과 같은지 검증하겠습니다.
NOTE
_
또 다른 테스트 방식은
TDD
Test
Driven
Development
(테스트 주도 개발)로 단위 테스트를 먼저 만드는 것
입니다. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

프로그래머의 길 멘토에게 묻다

프로그래머의 길 멘토에게 묻다

David Hoover, Adewale Oshineye, Kang Jung Bin
SRE를 위한 시스템 설계와 구축

SRE를 위한 시스템 설계와 구축

헤더 애드킨스, 벳시 바이어, 폴 블랭킨십, 피오트르 레반도프스키, 애나 오프레아, 애덤 스터블필드

Publisher Resources

ISBN: 9791169210966