일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
30 | 31 |
- 스프링컨테이너
- http 메시지 컨버터
- 테스트코드
- JSON
- 티스토리챌린지
- DI
- 참조변수
- 오블완
- 추상클래스
- 다형성
- 백준
- 싱글톤
- HttpServletResponse
- objecterror
- 예외와 트랜잭션 커밋
- @configuration
- equals()
- 프록시
- 코드트리
- 스프링
- html form
- java
- 의존관계
- 서블릿
- 김영한
- fielderror
- 코딩테스트
- 인터페이스
- 코드트리조별과제
- 오버라이딩
- Today
- Total
목록TIL/김영한의 스프링 DB 2편 (3)
minOS

비즈니스 예외란? 비즈니스 로직을 다루다 보면 "비즈니스 예외"라는 개념이 등장한다.단순한 시스템 오류와는 다른 개념인데, 정확히 어떤 의미일까?간단한 주문 예제를 통해 쉽게 이해해보자.주문 처리 흐름온라인 쇼핑몰에서 고객이 상품을 주문하면 다음과 같은 과정이 진행된다.정상적인 주문 처리주문 후 결제가 성공하면주문 데이터를 저장하고결제 상태를 "완료"로 변경한다.시스템 예외 (예상하지 못한 오류)주문 과정에서 복구 불가능한 예외 발생 (예: DB 장애, 네트워크 오류 등)전체 데이터를 롤백하고 주문을 취소한다.비즈니스 예외 (업무 규칙에 따른 예외)결제 잔고가 부족하면주문 데이터를 그대로 저장하지만결제 상태를 "대기"로 설정고객에게 잔고 부족을 알리고 별도의 계좌로 입금하도록 안내비즈니스 예외의 핵심비즈..

예외와 트랜잭션 커밋,롤백package com.example.springtx.exception;import lombok.extern.slf4j.Slf4j;import org.assertj.core.api.Assertions;import org.junit.jupiter.api.Test;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.test.context.SpringBootTest;import org.springframework.boot.test.context.TestConfiguration;import org.springframework.context.annotation.Bean;imp..

프록시 내부 호출 문제 예시package com.example.springtx.apply;import lombok.extern.slf4j.Slf4j;import org.junit.jupiter.api.Test;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.test.context.SpringBootTest;import org.springframework.boot.test.context.TestConfiguration;import org.springframework.context.annotation.Bean;import org.springframework.transaction.annota..