Swagger(Springdoc OpenAPI)에서 불필요한 컬럼이 보이는 이유는API 응답에 DTO를 써야 하는데 Entity를 그대로 사용하기 때문이다. ❌ 문제@GetMapping("/users/{id}")public UserEntity getUser(@PathVariable Long id) { return userService.getUser(id);}UserEntity를 직접 반환하므로, Swagger에서 모든 필드(password, phoneNumber 등)가 API 문서에 포함된다. ✅ 해결법→ Swagger에서 불필요한 컬럼이 보이면, Entity 대신 DTO를 사용하자@GetMapping("/users/{id}")public UserDto getUser(@PathVariable Lon..
1. DAO (Data Access Object)DAO는 DB와 직접 통신을 하면서 데이터를 저장하고, 가져오는 객체이다.사용처 : `MyBatis` 혹은 `JPA`와 같은 ORM에서 실제로 DB 접근을 담당하는 객체특징: 보통 인터페이스 + Mapper (XML or 어노테이션 방식)으로 구성됨 예제 (MyBatis)import org.apache.ibatis.annotations.Mapper;import org.apache.ibatis.annotations.Insert;import org.apache.ibatis.annotations.Select;import org.apache.ibatis.annotations.Param;@Mapperpublic interface UserDAO { // ..
1. Model (모델) package ex03_뮤직플레이어; public class Music { // Model : 데이터를 가지고 있는 객체 private String title; // 노래제목 private String singer; // 가수 private String path; // 노래 저장 경로 public Music(String title, String singer, String path) { this.title = title; this.singer = singer; this.path = path; } // (2) getter 메소드 public String getTitle() { return title; } public String getSinger() { return singer; }..