springboot
-
Spring boot 패키지 구조Java 2023. 10. 17. 15:32
계층형 vs 도메인형 계층형 구조 각 계층을 대표하는 디렉터리를 기준으로 패키지를 나눈 것 장점: 프로젝트의 이해도가 낮아도 전체적인 구조를 빠르게 파악 가능 단점: 디렉터리 안에 클래스들이 많이 모이게 됨 도메인형 구조 도메인 디렉터리를 기준으로 패키지를 나눈 것 장점: 도메인의 관련 코드를 응집할 수 있음 단점: 프로젝트의 이해도가 낮을 경우 전체적인 구조 파악 어려움 계층형 Directory 구조 src/main/java 자바 파일들을 담음 controller service db repository (dao) entity global (공통적으로 사용되는 것들) auth exception model (dto) config: JpaConfig.java src/main/resources 리소스 파일들을..
-
Spring boot 프로젝트 만들기Java 2023. 10. 17. 02:14
1. New Project -> Spring Initializr -> Next Type: 빌드 타입 Group: 도메인 이름이나 회사 Artifact: 프로젝트 이름 Packaging: 패키징 방법 더보기 2. 의존성 추가 Spring Web: HTTP 클라이언트와 Spring의 원격 지원을 위한 웹 관련 부분 제공 (과거에는 tomcat 깔고 설정하고 귀찮았는데 tomcat을 내장되어 있어 java 프로그램 돌리면 서버가 뜸) Lombok: 반복적인 개발을 줄일 수 있는 여러 기능 제공하는 자바 라이브러리 (ex. Getter, Setter 자동완성 ...) Spring Data JPA: JPA기반 repository를 만들 수 있도록 기능 제공 MySQL Driver: MySQL DB에 접근하기 위한..