diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/_common/util/FileUtil.java b/src/main/java/org/ktc2/cokaen/wouldyouin/_common/util/FileUtil.java index 3e14780e..e0970c02 100644 --- a/src/main/java/org/ktc2/cokaen/wouldyouin/_common/util/FileUtil.java +++ b/src/main/java/org/ktc2/cokaen/wouldyouin/_common/util/FileUtil.java @@ -49,21 +49,13 @@ public static String createRandomFileName(String extension) { return UUID.randomUUID().toString().replace("-", "") + "." + extension; } - public static String getExtension(MultipartFile file) { - if (file == null || file.getContentType() == null) { - throw new ExtensionParsingException("파일이 존재하지 않거나 콘텐츠 타입이 없습니다."); - } + public static String getExtension(String contentType) { try { - return file.getContentType().split("/")[1]; + return contentType.split("/")[1]; + } catch (NullPointerException e) { + throw new ExtensionParsingException("파일이 존재하지 않거나 콘텐츠 타입이 없습니다."); } catch (ArrayIndexOutOfBoundsException e) { throw new ExtensionParsingException("파일의 확장자를 찾을 수 없습니다."); } } - - public static String getExtension(String url) { - if (url == null || !url.contains(".")) { - throw new ExtensionParsingException("URL이 존재하지 않거나 확장자가 없습니다."); - } - return url.substring(url.lastIndexOf('.') + 1); - } } \ No newline at end of file diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/_common/util/RestClientUtil.java b/src/main/java/org/ktc2/cokaen/wouldyouin/_common/util/RestClientUtil.java index a1a1e533..9ed39e5f 100644 --- a/src/main/java/org/ktc2/cokaen/wouldyouin/_common/util/RestClientUtil.java +++ b/src/main/java/org/ktc2/cokaen/wouldyouin/_common/util/RestClientUtil.java @@ -4,6 +4,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatusCode; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import org.springframework.web.client.RestClient; import org.springframework.web.client.RestClient.ResponseSpec.ErrorHandler; @@ -23,6 +24,15 @@ public T get(Class classType, String url, HttpHeaders headers, ErrorHandl .body(classType); } + public ResponseEntity getResponseEntity(Class classType, String url, HttpHeaders headers, ErrorHandler errorHandler) { + return client.get() + .uri(url) + .headers(httpHeaders -> httpHeaders.putAll(headers)) + .retrieve() + .onStatus(Predicate.not(HttpStatusCode::is2xxSuccessful), errorHandler) + .toEntity(classType); + } + public T post( Class classType, String url, HttpHeaders headers, ErrorHandler errorHandler) { return client.post() .uri(url) diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/auth/application/oauth/GoogleRequestService.java b/src/main/java/org/ktc2/cokaen/wouldyouin/auth/application/oauth/GoogleRequestService.java index 1b378ab2..d5a46366 100644 --- a/src/main/java/org/ktc2/cokaen/wouldyouin/auth/application/oauth/GoogleRequestService.java +++ b/src/main/java/org/ktc2/cokaen/wouldyouin/auth/application/oauth/GoogleRequestService.java @@ -2,7 +2,10 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; +import jakarta.annotation.PostConstruct; import java.util.Objects; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.ktc2.cokaen.wouldyouin._common.util.RestClientUtil; import org.ktc2.cokaen.wouldyouin._common.util.UriUtil; import org.ktc2.cokaen.wouldyouin.auth.application.oauth.dto.AccessTokenResponse; @@ -14,7 +17,9 @@ import org.springframework.http.MediaType; import org.springframework.stereotype.Service; +@Slf4j @Service +@RequiredArgsConstructor public class GoogleRequestService extends OauthRequestService { @Value("${oauth.google.uri.login.host}") @@ -39,13 +44,12 @@ public class GoogleRequestService extends OauthRequestService { private String redirectUri; private final RestClientUtil client; - private final String loginRequestUri; - private final String accessRequestUri; - private final HttpHeaders loginRequestHeaders; - - public GoogleRequestService(RestClientUtil restClientUtil) { - this.client = restClientUtil; + private String loginRequestUri; + private String accessRequestUri; + private HttpHeaders loginRequestHeaders; + @PostConstruct + private void init() { loginRequestUri = UriUtil.buildUrl("https", loginRequestHost, loginRequestPath); accessRequestUri = UriUtil.buildUrl("https", accessRequestHost, accessRequestPath); @@ -89,6 +93,8 @@ GoogleAccessRequestResponse.class, accessRequestUri, getAccessRequestHeaders(aut // TODO: 커스텀 예외 추가 (req, rsp) -> { throw new RuntimeException("에러"); }); + log.debug("#### GoogleAccessRequestResponse result = {}", result); + Objects.requireNonNull(result); return OauthResourcesResponse.builder() .socialId(result.id) diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/auth/application/oauth/KakaoRequestService.java b/src/main/java/org/ktc2/cokaen/wouldyouin/auth/application/oauth/KakaoRequestService.java index 22defe71..20d618fa 100644 --- a/src/main/java/org/ktc2/cokaen/wouldyouin/auth/application/oauth/KakaoRequestService.java +++ b/src/main/java/org/ktc2/cokaen/wouldyouin/auth/application/oauth/KakaoRequestService.java @@ -2,9 +2,12 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; +import jakarta.annotation.PostConstruct; import java.util.Objects; import lombok.Getter; import lombok.RequiredArgsConstructor; +import lombok.ToString; +import lombok.extern.slf4j.Slf4j; import org.ktc2.cokaen.wouldyouin._common.util.RestClientUtil; import org.ktc2.cokaen.wouldyouin._common.util.UriUtil; import org.ktc2.cokaen.wouldyouin.auth.application.oauth.dto.AccessTokenResponse; @@ -16,9 +19,10 @@ import org.springframework.http.MediaType; import org.springframework.stereotype.Service; import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; +@Slf4j @Service +@RequiredArgsConstructor public class KakaoRequestService extends OauthRequestService { @Value("${oauth.kakao.uri.login.host}") @@ -48,28 +52,23 @@ protected AccountType getAccountType() { } private final RestClientUtil client; - private final String loginRequestUri; - private final String accessRequestUri; - private final HttpHeaders loginRequestHeaders; + private String accessRequestUri; + private HttpHeaders loginRequestHeaders; - public KakaoRequestService(RestClientUtil restClientUtil) { - this.client = restClientUtil; - - loginRequestUri = UriUtil.buildUrl("https", loginRequestHost, loginRequestPath, getLoginRequestQueryParams()); + @PostConstruct + private void init() { accessRequestUri = UriUtil.buildUrl("https", accessRequestHost, accessRequestPath); - loginRequestHeaders = new HttpHeaders(); loginRequestHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE); } - protected MultiValueMap getLoginRequestQueryParams() { - OauthRequest request = getOauthRequestBase(); + protected String getLoginRequestUri(OauthRequest request) { var queries = new LinkedMultiValueMap(); queries.add("grant_type", request.getGrantType()); queries.add("client_id", request.getClientId()); queries.add("client_secret", request.getClientSecret()); queries.add("code", request.getCode()); - return queries; + return UriUtil.buildUrl("https", loginRequestHost, loginRequestPath, queries); } protected HttpHeaders getAccessRequestHeaders(AccessTokenResponse authenticationResponse) { @@ -92,9 +91,11 @@ protected OauthRequest getOauthRequestBase() { @Override protected OauthResourcesResponse requestLoginAndAccessResources(OauthRequest request) { AccessTokenResponse authenticationResponse = client.post( - AccessTokenResponse.class, loginRequestUri, loginRequestHeaders, + AccessTokenResponse.class, getLoginRequestUri(request), loginRequestHeaders, // TODO: 커스텀 예외 추가 - (req, rsp) -> { throw new RuntimeException("에러"); }); + (req, rsp) -> { + throw new RuntimeException("에러"); + }); Objects.requireNonNull(authenticationResponse); KakaoAccessRequestResponse result = client.get( @@ -102,6 +103,8 @@ KakaoAccessRequestResponse.class, accessRequestUri, getAccessRequestHeaders(auth // TODO: 커스텀 예외 추가 (req, rsp) -> { throw new RuntimeException("에러"); }); + log.debug("#### KakaoAccessRequestResponse result = {}", result); + Objects.requireNonNull(result); return OauthResourcesResponse.builder() .socialId(result.getId().toString()) @@ -114,6 +117,7 @@ KakaoAccessRequestResponse.class, accessRequestUri, getAccessRequestHeaders(auth @JsonNaming(SnakeCaseStrategy.class) @RequiredArgsConstructor @Getter + @ToString static class KakaoAccessRequestResponse { private final Long id; @@ -123,6 +127,7 @@ static class KakaoAccessRequestResponse { @JsonNaming(SnakeCaseStrategy.class) @RequiredArgsConstructor @Getter + @ToString static class KakaoAccount { private final Profile profile; @@ -132,6 +137,7 @@ static class KakaoAccount { @JsonNaming(SnakeCaseStrategy.class) @RequiredArgsConstructor @Getter + @ToString static class Profile { private final String nickname; diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/image/api/ImageController.java b/src/main/java/org/ktc2/cokaen/wouldyouin/image/api/ImageController.java index d2b52044..d7fd69ca 100644 --- a/src/main/java/org/ktc2/cokaen/wouldyouin/image/api/ImageController.java +++ b/src/main/java/org/ktc2/cokaen/wouldyouin/image/api/ImageController.java @@ -38,6 +38,11 @@ public ResponseEntity getImage(@PathVariable String directory, @PathVari return ResponseEntity.status(HttpStatus.OK).body(imageStorageService.readFromDirectory(Paths.get(directory, file))); } + @GetMapping(value = "/{directory}/{thumbnail}/{file}", produces = {MediaType.IMAGE_PNG_VALUE, MediaType.IMAGE_JPEG_VALUE}) + public ResponseEntity getThumnailImage(@PathVariable String directory, @PathVariable String thumbnail, @PathVariable String file) { + return ResponseEntity.status(HttpStatus.OK).body(imageStorageService.readFromDirectory(Paths.get(directory, thumbnail, file))); + } + @PostMapping public ResponseEntity>> uploadImages( @RequestParam List images, diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/image/application/ImageService.java b/src/main/java/org/ktc2/cokaen/wouldyouin/image/application/ImageService.java index 24e4facd..e1baccab 100644 --- a/src/main/java/org/ktc2/cokaen/wouldyouin/image/application/ImageService.java +++ b/src/main/java/org/ktc2/cokaen/wouldyouin/image/application/ImageService.java @@ -54,7 +54,7 @@ public void deleteImage(MemberIdentifier identifier, Long imageId) { } public String createThumbnail(String fileName) { - return imageStorageService.createThumbnailImage(getChildPath(), fileName); + return imageStorageService.createThumbnailImage(parentPath, getChildPath(), fileName); } public T getById(Long id) { diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/image/application/ImageStorageService.java b/src/main/java/org/ktc2/cokaen/wouldyouin/image/application/ImageStorageService.java index 5a7ad62d..09b77453 100644 --- a/src/main/java/org/ktc2/cokaen/wouldyouin/image/application/ImageStorageService.java +++ b/src/main/java/org/ktc2/cokaen/wouldyouin/image/application/ImageStorageService.java @@ -11,8 +11,10 @@ import org.ktc2.cokaen.wouldyouin._common.exception.FailedToUploadImageException; import org.ktc2.cokaen.wouldyouin._common.util.FileUtil; import org.ktc2.cokaen.wouldyouin._common.util.RestClientUtil; +import org.ktc2.cokaen.wouldyouin._common.util.UriUtil; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import org.springframework.web.multipart.MultipartFile; @@ -42,31 +44,36 @@ public byte[] readFromDirectory(Path childPath) { } public ImageRequest saveToDirectory(MultipartFile image, String childPath) { - String extension = FileUtil.getExtension(image); + String extension = FileUtil.getExtension(image.getContentType()); String fileName = FileUtil.createRandomFileName(extension); FileUtil.saveFile(image, Path.of(parentPath, childPath, fileName)); return ImageRequest.of(fileName, image.getSize(), extension); } public ImageRequest saveToDirectory(String imageUrl, String childPath) { - byte[] response = client.get(byte[].class, imageUrl, new HttpHeaders(), + ResponseEntity response = client.getResponseEntity(byte[].class, imageUrl, new HttpHeaders(), (req, rsp) -> { throw new FailedToUploadImageException("이미지 URL에 대한 요청을 실패하였습니다."); } ); - Optional.ofNullable(response).orElseThrow( + + String contentType = Optional.ofNullable(response.getHeaders().getContentType()).orElseThrow( + () -> new FailedToUploadImageException("응답 헤더에 콘텐츠 타입이 없어 이미지를 가져올 수 없습니다.") + ).toString(); + byte[] body = Optional.ofNullable(response.getBody()).orElseThrow( () -> new FailedToUploadImageException("응답 본문이 비어있어 이미지를 가져올 수 없습니다.") ); - String extension = FileUtil.getExtension(imageUrl); + + String extension = FileUtil.getExtension(contentType); String fileName = FileUtil.createRandomFileName(extension); Path path = Path.of(parentPath, childPath, fileName); - FileUtil.saveFile(response, path); - return ImageRequest.of(fileName, (long) response.length, extension); + FileUtil.saveFile(response.getBody(), path); + return ImageRequest.of(fileName, (long)body.length, extension); } // TODO : 썸네일 생성 코드 리팩토링, 파일 유틸로 이동 - public String createThumbnailImage(String childPath, String originFileName) { - String fileName = FileUtil.createRandomFileName(thumbnailExtension); + public String createThumbnailImage(String apiHeader, String childPath, String originFileName) { + String fileName = originFileName; String originImagePath = Path.of(parentPath, childPath, originFileName).toString(); String thumbnailImagePath = Path.of(parentPath, childPath, thumbnailChildPath).toString(); try { @@ -77,7 +84,7 @@ public String createThumbnailImage(String childPath, String originFileName) { } catch (Exception e) { throw new RuntimeException(e); } - return fileName; + return UriUtil.assembleFullUrl(apiHeader,childPath, thumbnailChildPath, fileName); } public void delete(String childPath, String fileName) { diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/member/api/dto/MemberResponse.java b/src/main/java/org/ktc2/cokaen/wouldyouin/member/api/dto/MemberResponse.java index 5ba6a985..3861e1c1 100644 --- a/src/main/java/org/ktc2/cokaen/wouldyouin/member/api/dto/MemberResponse.java +++ b/src/main/java/org/ktc2/cokaen/wouldyouin/member/api/dto/MemberResponse.java @@ -19,6 +19,7 @@ public class MemberResponse { private String nickname; private String phoneNumber; private String profileUrl; + private String profileThumbnailUrl; private MemberType memberType; private Area area; @@ -29,25 +30,27 @@ public class MemberResponse { private List hashtag; - private static MemberResponseBuilder responseBase(BaseMember baseMember) { + private static MemberResponseBuilder responseBase(BaseMember baseMember, String profileUrl) { return MemberResponse.builder() .memberId(baseMember.getId()) .nickname(baseMember.getNickname()) .phoneNumber(baseMember.getPhone()) - .profileUrl(baseMember.getProfileImage().getName()); + .profileUrl(profileUrl) + .profileThumbnailUrl(baseMember.getProfileImageThumbnailUrl()); + } // TODO: normal member임에도 불구, curator 형식이 호출되는 현상 수정필요 - public static MemberResponse from(final Member member) { - return responseBase(member) + public static MemberResponse from(final Member member, String profileUrl) { + return responseBase(member, profileUrl) .memberType(member.getMemberType()) .area(member.getArea()) .gender(member.getGender()) .build(); } - public static MemberResponse from(final Host host) { - return responseBase(host) + public static MemberResponse from(final Host host, String profileUrl) { + return responseBase(host, profileUrl) .memberType(host.getMemberType()) .intro(host.getIntro()) .likes(host.getLikes()) @@ -55,8 +58,8 @@ public static MemberResponse from(final Host host) { .build(); } - public static MemberResponse from(final Curator curator) { - return responseBase(curator) + public static MemberResponse from(final Curator curator, String profileUrl) { + return responseBase(curator, profileUrl) .memberType(curator.getMemberType()) .area(curator.getArea()) .gender(curator.getGender()) diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/member/api/dto/request/MemberAdditionalInfoRequest.java b/src/main/java/org/ktc2/cokaen/wouldyouin/member/api/dto/request/MemberAdditionalInfoRequest.java index 2f3ea13a..f7d2fffc 100644 --- a/src/main/java/org/ktc2/cokaen/wouldyouin/member/api/dto/request/MemberAdditionalInfoRequest.java +++ b/src/main/java/org/ktc2/cokaen/wouldyouin/member/api/dto/request/MemberAdditionalInfoRequest.java @@ -8,7 +8,7 @@ @RequiredArgsConstructor public class MemberAdditionalInfoRequest { - private final String phone; - private final Area area; - private final String gender; + private String phone; + private Area area; + private String gender; } diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/member/application/CuratorService.java b/src/main/java/org/ktc2/cokaen/wouldyouin/member/application/CuratorService.java index 836757a9..452e0601 100644 --- a/src/main/java/org/ktc2/cokaen/wouldyouin/member/application/CuratorService.java +++ b/src/main/java/org/ktc2/cokaen/wouldyouin/member/application/CuratorService.java @@ -32,7 +32,8 @@ public LikeableMemberService getLikeableMemberService() { @Override @Transactional(readOnly = true) public MemberResponse getMemberResponseById(Long id) { - return MemberResponse.from(getByIdOrThrow(id)); + Curator curator = getByIdOrThrow(id); + return MemberResponse.from(curator, memberImageService.getImageUrl(curator.getProfileImage())); } @Override @@ -73,18 +74,17 @@ public MemberResponse createCurator(Long normalMemberId) { baseMemberRepository.flush(); curatorRepository.save(curator); - return MemberResponse.from(curator); + return MemberResponse.from(curator, memberImageService.getImageUrl(curator.getProfileImage())); } - // TODO : 반대방향 연관관계 설정 setter? @Transactional public MemberResponse updateCurator(Long curatorId, CuratorEditRequest request) { Curator curator = getByIdOrThrow(curatorId); MemberImage image = memberImageService.getById(request.getProfileImageId()); String thumbnailImageUrl = memberImageService.createThumbnail(image.getName()); curator.updateFrom(request, image, thumbnailImageUrl); - image.setBaseMember(curator); - return MemberResponse.from(curator); + memberImageService.setBaseMember(image, curator); + return MemberResponse.from(curator, memberImageService.getImageUrl(curator.getProfileImage())); } @Override diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/member/application/HostService.java b/src/main/java/org/ktc2/cokaen/wouldyouin/member/application/HostService.java index de747ed0..083e3603 100644 --- a/src/main/java/org/ktc2/cokaen/wouldyouin/member/application/HostService.java +++ b/src/main/java/org/ktc2/cokaen/wouldyouin/member/application/HostService.java @@ -30,7 +30,7 @@ public MemberResponse createHost(HostCreateRequest request) { String profileImageThumbnailUrl = memberImageService.createThumbnail(profileImage.getName()); Host createdHost = hostRepository.save(request.toEntity(hashedPassword, profileImage, profileImageThumbnailUrl)); memberImageService.setBaseMember(profileImage, createdHost); - return MemberResponse.from(createdHost); + return MemberResponse.from(createdHost, memberImageService.getImageUrl(profileImage)); } // TODO: 리팩토링할것 @@ -49,7 +49,7 @@ public MemberResponse updateHost(Long hostId, HostEditRequest request) { host.setProfileImageThumbnailUrl(url); }); - return MemberResponse.from(host); + return MemberResponse.from(host, memberImageService.getImageUrl(host.getProfileImage())); } @Override @@ -61,16 +61,15 @@ public void deleteById(Long id) { @Override @Transactional(readOnly = true) public MemberResponse getMemberResponseById(Long id) { - return MemberResponse.from(getByIdOrThrow(id)); + Host host = getByIdOrThrow(id); + return MemberResponse.from(host, memberImageService.getImageUrl(host.getProfileImage())); } @Transactional(readOnly = true) public MemberResponse getMemberResponseBy(LocalLoginRequest loginRequest) { - return MemberResponse.from(hostRepository - .findByEmailAndHashedPassword( - loginRequest.email(), - passwordEncoder.encode(loginRequest.password())) - .orElseThrow(RuntimeException::new)); + Host host = hostRepository.findByEmailAndHashedPassword(loginRequest.email(), passwordEncoder.encode(loginRequest.password())) + .orElseThrow(RuntimeException::new); + return MemberResponse.from(host, memberImageService.getImageUrl(host.getProfileImage())); } @Transactional(readOnly = true) diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/member/application/MemberService.java b/src/main/java/org/ktc2/cokaen/wouldyouin/member/application/MemberService.java index 1e95c56e..79c5527e 100644 --- a/src/main/java/org/ktc2/cokaen/wouldyouin/member/application/MemberService.java +++ b/src/main/java/org/ktc2/cokaen/wouldyouin/member/application/MemberService.java @@ -26,7 +26,9 @@ public class MemberService implements MemberServiceCommonBehavior { public MemberResponse createMember(MemberCreateRequest request) { MemberImage profileImage = memberImageService.convert(request.getProfileImageUrl()); String thumbnailImageUrl = memberImageService.createThumbnail(profileImage.getName()); - return MemberResponse.from(memberRepository.save(request.toEntity(profileImage, thumbnailImageUrl))); + Member member = memberRepository.save(request.toEntity(profileImage, thumbnailImageUrl)); + memberImageService.setBaseMember(profileImage, member); + return MemberResponse.from(member, memberImageService.getImageUrl(profileImage)); } // TODO : 리팩토링 꼭 할 것, 멤버 전체에 대해 연관관계 설정할 것 @@ -43,18 +45,19 @@ public MemberResponse updateMember(Long memberId, MemberEditRequest editRequest) String url = memberImageService.createThumbnail(memberImageService.createThumbnail(image.getName())); member.setProfileImageThumbnailUrl(url); }); - return MemberResponse.from(member); + return MemberResponse.from(member, memberImageService.getImageUrl(member.getProfileImage())); } @Transactional public MemberResponse updateWelcomeMember(Long welcomeMemberId, MemberAdditionalInfoRequest additionalInfoRequest) { Member member = getByIdOrThrow(welcomeMemberId); + // TODO : validate if (member.getMemberType() != MemberType.welcome) { // TODO: 커스텀 예외 필요 throw new RuntimeException("Welcome Member가 아닙니다."); } member.updateFrom(additionalInfoRequest); - return MemberResponse.from(member); + return MemberResponse.from(member, memberImageService.getImageUrl(member.getProfileImage())); } @Override @@ -66,7 +69,8 @@ public void deleteById(Long id) { @Override @Transactional(readOnly = true) public MemberResponse getMemberResponseById(Long id) { - return MemberResponse.from(getByIdOrThrow(id)); + Member member = getByIdOrThrow(id); + return MemberResponse.from(member, memberImageService.getImageUrl(member.getProfileImage())); } @Transactional(readOnly = true) diff --git a/src/main/resources/application-deploy.yml b/src/main/resources/application-deploy.yml index a23c61e7..329c63a0 100644 --- a/src/main/resources/application-deploy.yml +++ b/src/main/resources/application-deploy.yml @@ -8,4 +8,6 @@ spring: on-profile: deploy jpa: hibernate: - ddl-auto: update \ No newline at end of file + ddl-auto: update + datasource: + url: ${DATASOURCE_URL}?useSSL=true&useUnicode=true&serverTimezone=Asia/Seoul \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index f3502ff5..fef18b26 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -23,7 +23,7 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: ${DATASOURCE_URL}?useSSL=false&useUnicode=true&serverTimezone=Asia/Seoul + url: ${DATASOURCE_URL}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&serverTimezone=Asia/Seoul username: ${DATASOURCE_USERNAME} password: ${DATASOURCE_PASSWORD}