diff --git a/build.gradle b/build.gradle index 2022ce8..0dec725 100644 --- a/build.gradle +++ b/build.gradle @@ -30,6 +30,7 @@ dependencies { testImplementation 'com.h2database:h2' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.mariadb.jdbc:mariadb-java-client' compileOnly 'org.projectlombok:lombok' runtimeOnly 'com.mysql:mysql-connector-j' annotationProcessor 'org.projectlombok:lombok' diff --git a/src/main/java/com/example/umc_9th/domain/review/controller/ReviewController.java b/src/main/java/com/example/umc_9th/domain/review/controller/ReviewController.java index 47b5a96..d26916d 100644 --- a/src/main/java/com/example/umc_9th/domain/review/controller/ReviewController.java +++ b/src/main/java/com/example/umc_9th/domain/review/controller/ReviewController.java @@ -1,7 +1,10 @@ package com.example.umc_9th.domain.review.controller; +import com.example.umc_9th.domain.review.dto.res.ReviewResponseDTO; import com.example.umc_9th.domain.review.entity.Review; import com.example.umc_9th.domain.review.service.ReviewQueryService; +import com.example.umc_9th.grobal.apiPayload.ApiResponse; +import com.example.umc_9th.grobal.apiPayload.code.GeneralSuccessCode; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -17,15 +20,16 @@ public class ReviewController { private final ReviewQueryService reviewQueryService; @GetMapping("/members/{memberId}/reviews/search") - public List searchMyReview( - // 경로에서 memberId를 받음 + public ApiResponse> searchMyReview( @PathVariable Long memberId, - @RequestParam(required = false) Long storeId, @RequestParam(required = false) Integer rating ) { - // 서비스로 memberId를 포함하여 전달 - return reviewQueryService.searchMyReviews(memberId, storeId, rating); + + + List reviewList = reviewQueryService.searchMyReviews(memberId, storeId, rating); + + return ApiResponse.success(GeneralSuccessCode.REVIEWS_FOUND, reviewList); } } diff --git a/src/main/java/com/example/umc_9th/domain/review/converter/ReviewConverter.java b/src/main/java/com/example/umc_9th/domain/review/converter/ReviewConverter.java new file mode 100644 index 0000000..3513dff --- /dev/null +++ b/src/main/java/com/example/umc_9th/domain/review/converter/ReviewConverter.java @@ -0,0 +1,29 @@ +package com.example.umc_9th.domain.review.converter; + +import com.example.umc_9th.domain.review.dto.res.ReviewResponseDTO; +import com.example.umc_9th.domain.review.entity.Review; + +import java.util.List; +import java.util.stream.Collectors; + +public class ReviewConverter { + + public static ReviewResponseDTO toReviewDTO(Review review) { + + + return ReviewResponseDTO.builder() + .reviewId(review.getId()) + .memberName(review.getMember().getName()) + .storeName(review.getStore().getName()) + .rating(review.getRating()) + .content(review.getContent()) + .build(); + } + + // Review 엔티티 리스트르르 DTO리스트로 변환 + public static List toReviewDTOList(List reviewList) { + return reviewList.stream() + .map(ReviewConverter::toReviewDTO) + .collect(Collectors.toList()); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc_9th/domain/review/dto/res/ReviewResponseDTO.java b/src/main/java/com/example/umc_9th/domain/review/dto/res/ReviewResponseDTO.java new file mode 100644 index 0000000..6bddbc9 --- /dev/null +++ b/src/main/java/com/example/umc_9th/domain/review/dto/res/ReviewResponseDTO.java @@ -0,0 +1,32 @@ +package com.example.umc_9th.domain.review.dto.res; + +import com.example.umc_9th.grobal.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + + + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ReviewResponseDTO extends BaseEntity { + + private Long reviewId; + + private String memberName; + + private String storeName; + + private Integer rating; + + + private String content; + + + +} \ No newline at end of file diff --git a/src/main/java/com/example/umc_9th/domain/review/entity/Review.java b/src/main/java/com/example/umc_9th/domain/review/entity/Review.java index d001c19..f189bb7 100644 --- a/src/main/java/com/example/umc_9th/domain/review/entity/Review.java +++ b/src/main/java/com/example/umc_9th/domain/review/entity/Review.java @@ -35,15 +35,4 @@ public class Review extends BaseEntity { @JoinColumn(name = "shop_id") private Store store; - - //양방향 고려 -// @OneToMany(fetch = FetchType.LAZY)//미션 테이블과1 :N관계매핑 -// @JoinColumn(name="mission_id") -// private List missions; -// -// @OneToMany(fetch = FetchType.LAZY)//리뷰 이미지와 1:N관계매핑 -// @JoinColumn(name="reviewImage_id") -// private List reviewImages; - - } diff --git a/src/main/java/com/example/umc_9th/domain/review/exception/ReviewException.java b/src/main/java/com/example/umc_9th/domain/review/exception/ReviewException.java new file mode 100644 index 0000000..e06895e --- /dev/null +++ b/src/main/java/com/example/umc_9th/domain/review/exception/ReviewException.java @@ -0,0 +1,10 @@ +package com.example.umc_9th.domain.review.exception; + +import com.example.umc_9th.grobal.apiPayload.code.BaseErrorCode; +import com.example.umc_9th.grobal.apiPayload.exception.GeneralException; + +public class ReviewException extends GeneralException { + public ReviewException(BaseErrorCode code) { + super(code); + } +} diff --git a/src/main/java/com/example/umc_9th/domain/review/exception/code/ReviewErrorCode.java b/src/main/java/com/example/umc_9th/domain/review/exception/code/ReviewErrorCode.java new file mode 100644 index 0000000..4f36085 --- /dev/null +++ b/src/main/java/com/example/umc_9th/domain/review/exception/code/ReviewErrorCode.java @@ -0,0 +1,38 @@ +package com.example.umc_9th.domain.review.exception.code; + +import com.example.umc_9th.grobal.apiPayload.code.BaseErrorCode; +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.springframework.http.HttpStatus; + +@Getter +@AllArgsConstructor +public enum ReviewErrorCode implements BaseErrorCode { + + // 리뷰 검색 관련 에러 + // 회원 에러 + MEMBER_NOT_FOUND(HttpStatus.NOT_FOUND, "REVIEW404_1", "해당 ID의 회원을 찾을 수 없습니다."), + // 평점 유효성 + INVALID_RATING_VALUE(HttpStatus.BAD_REQUEST, "REVIEW400_1", "평점 값은 1에서 5 사이여야 합니다."); + + private final HttpStatus status; + private final String code; + private final String message; + + + @Override + public HttpStatus getStatus() { + return this.status; + } + + @Override + public String getCode() { + return this.code; + } + + @Override + public String getMessage() { + return this.message; + } + +} \ No newline at end of file diff --git a/src/main/java/com/example/umc_9th/domain/review/service/ReviewQueryService.java b/src/main/java/com/example/umc_9th/domain/review/service/ReviewQueryService.java index 8896982..9f04f95 100644 --- a/src/main/java/com/example/umc_9th/domain/review/service/ReviewQueryService.java +++ b/src/main/java/com/example/umc_9th/domain/review/service/ReviewQueryService.java @@ -1,6 +1,11 @@ package com.example.umc_9th.domain.review.service; +import com.example.umc_9th.domain.member.repository.MemberRepository; +import com.example.umc_9th.domain.review.converter.ReviewConverter; +import com.example.umc_9th.domain.review.dto.res.ReviewResponseDTO; import com.example.umc_9th.domain.review.entity.Review; +import com.example.umc_9th.domain.review.exception.ReviewException; +import com.example.umc_9th.domain.review.exception.code.ReviewErrorCode; import com.example.umc_9th.domain.review.repository.ReviewRepository; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -14,9 +19,23 @@ public class ReviewQueryService { private final ReviewRepository reviewRepository; + private final MemberRepository memberRepository; - public List searchMyReviews(Long memberId, Long storeId, Integer rating) { - return reviewRepository.findMyReviews(memberId, storeId, rating); - } + public List searchMyReviews(Long memberId, Long storeId, Integer rating) { + + + // 회원 유효성 검사 + memberRepository.findById(memberId) + .orElseThrow(() -> new ReviewException(ReviewErrorCode.MEMBER_NOT_FOUND)); + + // 평점값 유효성 검사 + if (rating != null && (rating < 1 || rating > 5)) { + throw new ReviewException(ReviewErrorCode.INVALID_RATING_VALUE); + } + List reviewList = reviewRepository.findMyReviews(memberId, storeId, rating); + + return ReviewConverter.toReviewDTOList(reviewList); + + } } diff --git a/src/main/java/com/example/umc_9th/domain/test/controller/TestController.java b/src/main/java/com/example/umc_9th/domain/test/controller/TestController.java new file mode 100644 index 0000000..a1c1d3d --- /dev/null +++ b/src/main/java/com/example/umc_9th/domain/test/controller/TestController.java @@ -0,0 +1,50 @@ +package com.example.umc_9th.domain.test.controller; + + +import com.example.umc_9th.domain.test.converter.TestConverter; +import com.example.umc_9th.domain.test.dto.res.TestResDTO; +import com.example.umc_9th.domain.test.exception.TestException; +import com.example.umc_9th.domain.test.service.query.TestQueryService; +import com.example.umc_9th.grobal.apiPayload.ApiResponse; +import com.example.umc_9th.grobal.apiPayload.code.GeneralErrorCode; +import com.example.umc_9th.grobal.apiPayload.code.GeneralSuccessCode; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/temp") +public class TestController { + + + private final TestQueryService testQueryService; + + + @GetMapping("/test") + public ApiResponse test() throws Exception { + // 응답 코드 정의 + GeneralSuccessCode code = GeneralSuccessCode.OK; + + throw new TestException(GeneralErrorCode.BAD_REQUEST); + +// return ApiResponse.success( +// code, +// TestConverter.toTestingDTO("This is Test!")); +// + } + + // 예외 상황 + @GetMapping("/exception") + public ApiResponse exception( + @RequestParam Long flag + ) { + testQueryService.checkFlag(flag); + + // 응답 코드 정의 + GeneralSuccessCode code = GeneralSuccessCode.OK; + return ApiResponse.success(code, TestConverter.toExceptionDTO("This is Test!")); + } +} diff --git a/src/main/java/com/example/umc_9th/domain/test/converter/TestConverter.java b/src/main/java/com/example/umc_9th/domain/test/converter/TestConverter.java new file mode 100644 index 0000000..c4e49cf --- /dev/null +++ b/src/main/java/com/example/umc_9th/domain/test/converter/TestConverter.java @@ -0,0 +1,26 @@ +package com.example.umc_9th.domain.test.converter; + +import com.example.umc_9th.domain.test.dto.res.TestResDTO; + +public class TestConverter { + + // 객체 -> DTO + public static TestResDTO.Testing toTestingDTO( + String testing + ) { + return TestResDTO.Testing.builder() + .testing(testing) + .build(); + } + + + // 예외객체 -> DTO + public static TestResDTO.Exception toExceptionDTO( + String testing + ){ + return TestResDTO.Exception.builder() + .testString(testing) + .build(); + } + +} \ No newline at end of file diff --git a/src/main/java/com/example/umc_9th/domain/test/dto/req/TestReqDTO.java b/src/main/java/com/example/umc_9th/domain/test/dto/req/TestReqDTO.java new file mode 100644 index 0000000..a1592b4 --- /dev/null +++ b/src/main/java/com/example/umc_9th/domain/test/dto/req/TestReqDTO.java @@ -0,0 +1,4 @@ +package com.example.umc_9th.domain.test.dto.req; + +public class TestReqDTO { +} diff --git a/src/main/java/com/example/umc_9th/domain/test/dto/res/TestResDTO.java b/src/main/java/com/example/umc_9th/domain/test/dto/res/TestResDTO.java new file mode 100644 index 0000000..8df1961 --- /dev/null +++ b/src/main/java/com/example/umc_9th/domain/test/dto/res/TestResDTO.java @@ -0,0 +1,22 @@ +package com.example.umc_9th.domain.test.dto.res; + + +import lombok.Builder; +import lombok.Getter; + +//DTO 하나만 만드록 안에다 스태틱으로 여러개 +//RequestDTO는 보통 프론트 그대로 받기 떄문에 빌더 패턴 적용할 필요 없음 +public class TestResDTO { + //DTO 자체는 수많은 곳에서 사용이 될 수 있기에 static class로 만들면 매번 class 파일을 만들 필요 없음 + @Builder + @Getter + public static class Testing { + private String testing; + } + + @Builder + @Getter + public static class Exception { + private String testString; + } +} diff --git a/src/main/java/com/example/umc_9th/domain/test/exception/TestException.java b/src/main/java/com/example/umc_9th/domain/test/exception/TestException.java new file mode 100644 index 0000000..903c214 --- /dev/null +++ b/src/main/java/com/example/umc_9th/domain/test/exception/TestException.java @@ -0,0 +1,10 @@ +package com.example.umc_9th.domain.test.exception; + +import com.example.umc_9th.grobal.apiPayload.code.BaseErrorCode; +import com.example.umc_9th.grobal.apiPayload.exception.GeneralException; + +public class TestException extends GeneralException { + public TestException(BaseErrorCode code) { + super(code); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc_9th/domain/test/exception/code/TestErrorCode.java b/src/main/java/com/example/umc_9th/domain/test/exception/code/TestErrorCode.java new file mode 100644 index 0000000..0cfa2a5 --- /dev/null +++ b/src/main/java/com/example/umc_9th/domain/test/exception/code/TestErrorCode.java @@ -0,0 +1,20 @@ +package com.example.umc_9th.domain.test.exception.code; + +import com.example.umc_9th.grobal.apiPayload.code.BaseErrorCode; +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.springframework.http.HttpStatus; + +@Getter +@AllArgsConstructor +public enum TestErrorCode implements BaseErrorCode { + + // For test + TEST_EXCEPTION(HttpStatus.BAD_REQUEST, "TEST400_1", "이거는 테스트"), + ; + + private final HttpStatus status; + private final String code; + private final String message; + +} \ No newline at end of file diff --git a/src/main/java/com/example/umc_9th/domain/test/service/query/TestQueryService.java b/src/main/java/com/example/umc_9th/domain/test/service/query/TestQueryService.java new file mode 100644 index 0000000..058ce11 --- /dev/null +++ b/src/main/java/com/example/umc_9th/domain/test/service/query/TestQueryService.java @@ -0,0 +1,5 @@ +package com.example.umc_9th.domain.test.service.query; + +public interface TestQueryService { + void checkFlag(Long flag); +} \ No newline at end of file diff --git a/src/main/java/com/example/umc_9th/domain/test/service/query/TestQueryServiceImpl.java b/src/main/java/com/example/umc_9th/domain/test/service/query/TestQueryServiceImpl.java new file mode 100644 index 0000000..e5fb52f --- /dev/null +++ b/src/main/java/com/example/umc_9th/domain/test/service/query/TestQueryServiceImpl.java @@ -0,0 +1,20 @@ +package com.example.umc_9th.domain.test.service.query; + +import com.example.umc_9th.domain.test.exception.TestException; +import com.example.umc_9th.domain.test.exception.code.TestErrorCode; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class TestQueryServiceImpl implements TestQueryService { + + + @Override + public void checkFlag(Long flag){ + if (flag == 1){ + throw new TestException(TestErrorCode.TEST_EXCEPTION); + } + } + +} diff --git a/src/main/java/com/example/umc_9th/grobal/apiPayload/ApiResponse.java b/src/main/java/com/example/umc_9th/grobal/apiPayload/ApiResponse.java new file mode 100644 index 0000000..c6360f2 --- /dev/null +++ b/src/main/java/com/example/umc_9th/grobal/apiPayload/ApiResponse.java @@ -0,0 +1,38 @@ +package com.example.umc_9th.grobal.apiPayload; + + +import com.example.umc_9th.grobal.apiPayload.code.BaseErrorCode; +import com.example.umc_9th.grobal.apiPayload.code.BaseSuccessCode; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +@JsonPropertyOrder({"isSuccess", "code", "message", "result"}) +public class ApiResponse { + + @JsonProperty("isSuccess") + private final Boolean isSuccess; + + @JsonProperty("code") + private final String code; + + @JsonProperty("message") + private final String message; + + @JsonProperty("result") + private T result; + + // 성공한 경우 (result 포함) + + public static ApiResponse success(BaseSuccessCode code, T result) { + return new ApiResponse<>(true, code.getCode(), code.getMessage(), result); + } + + // 실패한 경우 (result 포함) + public static ApiResponse onFailure(BaseErrorCode code, T result) { + return new ApiResponse<>(false, code.getCode(), code.getMessage(), result); + } +} diff --git a/src/main/java/com/example/umc_9th/grobal/apiPayload/code/BaseErrorCode.java b/src/main/java/com/example/umc_9th/grobal/apiPayload/code/BaseErrorCode.java new file mode 100644 index 0000000..453a364 --- /dev/null +++ b/src/main/java/com/example/umc_9th/grobal/apiPayload/code/BaseErrorCode.java @@ -0,0 +1,10 @@ +package com.example.umc_9th.grobal.apiPayload.code; + +import org.springframework.http.HttpStatus; + +public interface BaseErrorCode { + + HttpStatus getStatus(); + String getCode(); + String getMessage(); +} \ No newline at end of file diff --git a/src/main/java/com/example/umc_9th/grobal/apiPayload/code/BaseSuccessCode.java b/src/main/java/com/example/umc_9th/grobal/apiPayload/code/BaseSuccessCode.java new file mode 100644 index 0000000..25e9fa0 --- /dev/null +++ b/src/main/java/com/example/umc_9th/grobal/apiPayload/code/BaseSuccessCode.java @@ -0,0 +1,11 @@ +package com.example.umc_9th.grobal.apiPayload.code; + +import org.springframework.http.HttpStatus; + +public interface BaseSuccessCode { + + HttpStatus getStatus(); + String getCode(); + String getMessage(); + +} diff --git a/src/main/java/com/example/umc_9th/grobal/apiPayload/code/GeneralErrorCode.java b/src/main/java/com/example/umc_9th/grobal/apiPayload/code/GeneralErrorCode.java new file mode 100644 index 0000000..5cceee1 --- /dev/null +++ b/src/main/java/com/example/umc_9th/grobal/apiPayload/code/GeneralErrorCode.java @@ -0,0 +1,32 @@ +package com.example.umc_9th.grobal.apiPayload.code; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.springframework.http.HttpStatus; + +@Getter +@AllArgsConstructor +public enum GeneralErrorCode implements BaseErrorCode{ + + BAD_REQUEST(HttpStatus.BAD_REQUEST, + "COMMON400_1", + "잘못된 요청입니다."), + UNAUTHORIZED(HttpStatus.UNAUTHORIZED, + "AUTH401_1", + "인증이 필요합니다."), + FORBIDDEN(HttpStatus.FORBIDDEN, + "AUTH403_1", + "요청이 거부되었습니다."), + NOT_FOUND(HttpStatus.NOT_FOUND, + "COMMON404_1", + "요청한 리소스를 찾을 수 없습니다."), + INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, + "COMMON500_1", + "예기치 않은 서버 에러가 발생했습니다."), + + ; + + private final HttpStatus status; + private final String code; + private final String message; +} \ No newline at end of file diff --git a/src/main/java/com/example/umc_9th/grobal/apiPayload/code/GeneralSuccessCode.java b/src/main/java/com/example/umc_9th/grobal/apiPayload/code/GeneralSuccessCode.java new file mode 100644 index 0000000..834b3e0 --- /dev/null +++ b/src/main/java/com/example/umc_9th/grobal/apiPayload/code/GeneralSuccessCode.java @@ -0,0 +1,46 @@ +package com.example.umc_9th.grobal.apiPayload.code; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import org.springframework.http.HttpStatus; + + +@Getter +@AllArgsConstructor +public enum GeneralSuccessCode implements BaseSuccessCode{ + + + // 성공응답 + OK(HttpStatus.OK,"Common200","응답 성공"), + CREATED(HttpStatus.CREATED, "COMMON201", "요청 성공,리소스 생성됨"), + MEMBER_FOUND(HttpStatus.OK, "MEMBER200", "회원을 조회했습니다."), + REVIEWS_FOUND(HttpStatus.OK, "REVIEW200", "리뷰 목록을 성공적으로 조회했습니다."); + + + + + + private HttpStatus status; + private String code; + private String message; + // BaseSuccessCode 인터페이스 구현 + @Override + public HttpStatus getStatus() { + return this.status; + } + + @Override + public String getCode() { + return this.code; + } + + @Override + public String getMessage() { + return this.message; + } + + + + +} diff --git a/src/main/java/com/example/umc_9th/grobal/apiPayload/exception/GeneralException.java b/src/main/java/com/example/umc_9th/grobal/apiPayload/exception/GeneralException.java new file mode 100644 index 0000000..a333803 --- /dev/null +++ b/src/main/java/com/example/umc_9th/grobal/apiPayload/exception/GeneralException.java @@ -0,0 +1,12 @@ +package com.example.umc_9th.grobal.apiPayload.exception; + +import com.example.umc_9th.grobal.apiPayload.code.BaseErrorCode; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class GeneralException extends RuntimeException { + + private final BaseErrorCode code; +} \ No newline at end of file diff --git a/src/main/java/com/example/umc_9th/grobal/apiPayload/handler/GeneralExceptionAdvice.java b/src/main/java/com/example/umc_9th/grobal/apiPayload/handler/GeneralExceptionAdvice.java new file mode 100644 index 0000000..8895273 --- /dev/null +++ b/src/main/java/com/example/umc_9th/grobal/apiPayload/handler/GeneralExceptionAdvice.java @@ -0,0 +1,43 @@ +package com.example.umc_9th.grobal.apiPayload.handler; + + +import com.example.umc_9th.grobal.apiPayload.ApiResponse; +import com.example.umc_9th.grobal.apiPayload.code.BaseErrorCode; +import com.example.umc_9th.grobal.apiPayload.code.GeneralErrorCode; +import com.example.umc_9th.grobal.apiPayload.exception.GeneralException; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +// Exception을 json 형식으로 응답 +@RestControllerAdvice +public class GeneralExceptionAdvice { + + // 애플리케이션에서 발생하는 커스텀 예외를 처리 + @ExceptionHandler(GeneralException.class) + public ResponseEntity> handleException( + GeneralException ex + ) { + + return ResponseEntity.status(ex.getCode().getStatus()) + .body(ApiResponse.onFailure( + ex.getCode(), + null + ) + ); + } + + // 그 외의 정의되지 않은 모든 예외 처리 + @ExceptionHandler(Exception.class) + public ResponseEntity> handleException( + Exception ex + ) { + BaseErrorCode code = GeneralErrorCode.INTERNAL_SERVER_ERROR; + return ResponseEntity.status(code.getStatus()) + .body(ApiResponse.onFailure( + code, + ex.getMessage() + ) + ); + } +} \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 920c008..6368497 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,19 +1,19 @@ spring: application: - name: "umc_9th" # "umc9th" + name: "umc_9th" datasource: - driver-class-name: com.mysql.cj.jdbc.Driver # - url: jdbc:mysql://localhost:3306/umc9th # - username: root # MySQL ?? ?? - password: 1234 # MySQL ???? + driver-class-name: org.mariadb.jdbc.Driver + url: jdbc:mariadb://localhost:3306/umc9th + username: root + password: 1234 jpa: - database: mysql # - database-platform: org.hibernate.dialect.MySQLDialect # - show-sql: true # + database: mysql + show-sql: true hibernate: - ddl-auto: create-drop # + # (경고) 테이블 생성 후 반드시 'validate'로 변경하세요. + ddl-auto: create-drop properties: hibernate: - format_sql: true # \ No newline at end of file + format_sql: true \ No newline at end of file