IT/Spring Boot

[Spring Boot] 스프링 부트 Layered Architecture

nohumb 2024. 9. 27. 21:31
SMALL

스프링 부트의 기본적인 아키텍처

https://images.app.goo.gl/pgxUSYdQUYLr47m78

  • Controller : 사용자 인터페이스, HTTP Request, Response를 처리하며 입력값 검증 등을 필요로 함. 요청이 들어올 경우 Service에서 로직을 호출해 처리함
  • Service : 비즈니스 로직, Controller에서 요청을 받으면 Service에서 로직으로 처리함. 데이터는 DAO(Repository)를 통해 CRUD를 진행함. Controller와 데이터를 주고 받을 때 DTO(Data Transfer Object)로 변환하여 캡슐화. Repository와는 Entity로 데이터를 주고 받음
  • Repository : DB에 접근하기 위한 메서드들을 가진 인터페이스
  • DAO(Repository) : Date Acess Object, DAO Interface와 repository 객체를 통해 DB와 상호작용. Spring에선 JPA가 이를 담당
LIST