diff --git a/src/main/java/com/example/HappyNewHere/controller/AccountController.java b/src/main/java/com/example/HappyNewHere/controller/AccountController.java index b4f6602..6e7c72b 100644 --- a/src/main/java/com/example/HappyNewHere/controller/AccountController.java +++ b/src/main/java/com/example/HappyNewHere/controller/AccountController.java @@ -6,6 +6,7 @@ import com.example.HappyNewHere.dto.request.AccountRequestDto; import com.example.HappyNewHere.service.AccountService; import com.example.HappyNewHere.service.KakaoService; +import com.example.HappyNewHere.utils.AuthenticateUtils; import com.example.HappyNewHere.utils.JwtUtils; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; @@ -21,7 +22,7 @@ @RequiredArgsConstructor @CrossOrigin public class AccountController { - + private final AuthenticateUtils authenticateUtils; private final AccountService accountService; private final KakaoService kakaoService; @@ -39,7 +40,8 @@ public ResponseEntity login( @GetMapping("/userInfo") public ResponseEntity personalInfo(Authentication authentication ) { - return ResponseEntity.ok().body(accountService.findAccount(Long.parseLong(authentication.getName()))); + Long accountId = authenticateUtils.getLongId(authentication); + return ResponseEntity.ok().body(accountService.findAccount(accountId)); } // 유저 id 뿐만 아니라 발급한 토큰 또한 필요함. @@ -49,8 +51,9 @@ public ResponseEntity personalInfo( @RequestParam String userId, @RequestParam String stateMsg ) { - accountService.addUserId(Long.parseLong(authentication.getName()), userId); - accountService.addStateMsg(Long.parseLong(authentication.getName()), stateMsg); + Long accountId = authenticateUtils.getLongId(authentication); + accountService.addUserId(accountId, userId); + accountService.addStateMsg(accountId, stateMsg); return ResponseEntity.ok().build(); } diff --git a/src/main/java/com/example/HappyNewHere/controller/CalenderController.java b/src/main/java/com/example/HappyNewHere/controller/CalenderController.java index 9f8194c..cd712f8 100644 --- a/src/main/java/com/example/HappyNewHere/controller/CalenderController.java +++ b/src/main/java/com/example/HappyNewHere/controller/CalenderController.java @@ -21,7 +21,7 @@ public class CalenderController { @GetMapping("{userId}") public ResponseEntity showCalender( - @PathVariable String userId, + @PathVariable(name = "userId") String userId, Authentication authentication){ //TODO: 헤더에서 accountId 가져오기 diff --git a/src/main/java/com/example/HappyNewHere/controller/MessageController.java b/src/main/java/com/example/HappyNewHere/controller/MessageController.java index 0d7f3ee..176dcda 100644 --- a/src/main/java/com/example/HappyNewHere/controller/MessageController.java +++ b/src/main/java/com/example/HappyNewHere/controller/MessageController.java @@ -6,21 +6,18 @@ import com.example.HappyNewHere.utils.AuthenticateUtils; import java.util.List; +import lombok.RequiredArgsConstructor; import org.springframework.security.core.Authentication; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping(value="/message") @CrossOrigin +@RequiredArgsConstructor public class MessageController { private final MessageService messageService; private final AuthenticateUtils authenticateUtils; - // 권한들 넣어주셈요 - public MessageController(MessageService messageService, AuthenticateUtils authenticateUtils) { - this.messageService = messageService; - this.authenticateUtils = authenticateUtils; - } @PostMapping("/create") public MessageDto createMessage( @@ -31,23 +28,23 @@ public MessageDto createMessage( return messageService.createMessage(userId,messageRequestDto); } - @GetMapping("/read/{userId}") - public List findAllMessages(@PathVariable String userId) { - return messageService.findAllMessages(userId); - } - - @GetMapping("/read/{userId}/{messageId}") - public MessageDto findMessage(@PathVariable String userId, @PathVariable Long messageId) { - return messageService.findOneMessage(messageId); - } - - @PutMapping("/update") - public Long updateMessage(@RequestBody MessageDto messageDto) { - return messageService.updateMessage(messageDto); - } - - @DeleteMapping("/delete/{messageId}") - public Long deleteMessage(@PathVariable Long messageId) { - return messageService.deleteMessage(messageId); - } +// @GetMapping("/read/{userId}") +// public List findAllMessages(@PathVariable String userId) { +// return messageService.findAllMessages(userId); +// } +// +// @GetMapping("/read/{userId}/{messageId}") +// public MessageDto findMessage(@PathVariable String userId, @PathVariable Long messageId) { +// return messageService.findOneMessage(messageId); +// } +// +// @PutMapping("/update") +// public Long updateMessage(@RequestBody MessageDto messageDto) { +// return messageService.updateMessage(messageDto); +// } +// +// @DeleteMapping("/delete/{messageId}") +// public Long deleteMessage(@PathVariable Long messageId) { +// return messageService.deleteMessage(messageId); +// } } diff --git a/src/main/java/com/example/HappyNewHere/domain/Account.java b/src/main/java/com/example/HappyNewHere/domain/Account.java index 1f32752..a66065e 100644 --- a/src/main/java/com/example/HappyNewHere/domain/Account.java +++ b/src/main/java/com/example/HappyNewHere/domain/Account.java @@ -28,8 +28,8 @@ public Account(Long accountId, String nickname, String userId, String profileImg this.stateMsg = stateMsg; } - public static Account of(Long accountId, AccountRequestDto accountRequestDto) { - return new Account(accountId, accountRequestDto.nickname(), accountRequestDto.userId(), accountRequestDto.profileImg(), accountRequestDto.stateMsg()); + public static Account of(Long accountId, AccountRequestDto accountRequestDto, String profileImg) { + return new Account(accountId, accountRequestDto.nickname(), accountRequestDto.userId(), profileImg, accountRequestDto.stateMsg()); } public Account(Long accountId) { diff --git a/src/main/java/com/example/HappyNewHere/domain/Messages.java b/src/main/java/com/example/HappyNewHere/domain/Messages.java index e75e47d..d0b8910 100644 --- a/src/main/java/com/example/HappyNewHere/domain/Messages.java +++ b/src/main/java/com/example/HappyNewHere/domain/Messages.java @@ -14,38 +14,31 @@ @Entity @Data -@NoArgsConstructor public class Messages { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long messageId; private LocalDateTime createdDate; private String context; - private String sender; // SenderUserId - private String receiver; // ReciverUserId + private Long sender; // kakooId + private Long receiver; //kakaoid private int paperNum; private boolean anonymous; - // dto -> entity - public Messages(MessageDto messageDto) { - this.messageId = messageDto.getMessageId(); - this.createdDate = messageDto.getCreatedDate(); - this.context = messageDto.getContext(); - this.sender = messageDto.getSender(); - this.receiver = messageDto.getReceiver(); - this.paperNum = messageDto.getPaperNum(); - this.anonymous = messageDto.isAnonymous(); // 왜 바로접근가능?? - } + private Messages() { + } + private Messages(LocalDateTime createdDate, String context, Long sender, Long receiver, int paperNum, boolean anonymous) { + this.createdDate = createdDate; + this.context = context; + this.sender = sender; + this.receiver = receiver; + this.paperNum = paperNum; + this.anonymous = anonymous; + } - // patch로 변경 ..? - public void update(MessageDto messageDto) { - this.messageId = messageDto.getMessageId(); - this.createdDate = messageDto.getCreatedDate(); - this.context = messageDto.getContext(); - this.sender = messageDto.getSender(); - this.receiver = messageDto.getReceiver(); - this.paperNum = messageDto.getPaperNum(); - this.anonymous = messageDto.isAnonymous(); + public static Messages of(LocalDateTime createdDate, String context, Long sender, Long receiver, int paperNum, boolean anonymous) { + return new Messages( createdDate, context, sender, receiver, paperNum, anonymous); } + } diff --git a/src/main/java/com/example/HappyNewHere/dto/MessageDto.java b/src/main/java/com/example/HappyNewHere/dto/MessageDto.java index aa9291f..ad70535 100644 --- a/src/main/java/com/example/HappyNewHere/dto/MessageDto.java +++ b/src/main/java/com/example/HappyNewHere/dto/MessageDto.java @@ -3,7 +3,10 @@ import com.example.HappyNewHere.domain.Messages; import java.time.LocalDateTime; import lombok.Data; +import lombok.NoArgsConstructor; + @Data +@NoArgsConstructor public class MessageDto { private Long messageId; private LocalDateTime createdDate; @@ -13,17 +16,6 @@ public class MessageDto { private int paperNum; private boolean anonymous; - // entity -> dto - public MessageDto(Messages messages) { - this.messageId = messages.getMessageId(); - this.createdDate = messages.getCreatedDate(); - this.context = messages.getContext(); - this.sender = messages.getSender(); - this.receiver = messages.getReceiver(); - this.paperNum = messages.getPaperNum(); - this.anonymous = messages.isAnonymous(); - } - public MessageDto(Long messageId, LocalDateTime createdDate, String context, String sender, String receiver, int paperNum, boolean anonymous) { this.messageId = messageId; @@ -34,4 +26,16 @@ public MessageDto(Long messageId, LocalDateTime createdDate, String context, Str this.paperNum = paperNum; this.anonymous = anonymous; } + + public static MessageDto from(Messages messages,String sender,String receiver) { + return new MessageDto( + messages.getMessageId(), + messages.getCreatedDate(), + messages.getContext(), + sender, + receiver, + messages.getPaperNum(), + messages.isAnonymous() + ); + } } \ No newline at end of file diff --git a/src/main/java/com/example/HappyNewHere/dto/request/MessageRequestDto.java b/src/main/java/com/example/HappyNewHere/dto/request/MessageRequestDto.java index b3dab3b..535dcbb 100644 --- a/src/main/java/com/example/HappyNewHere/dto/request/MessageRequestDto.java +++ b/src/main/java/com/example/HappyNewHere/dto/request/MessageRequestDto.java @@ -12,18 +12,18 @@ public class MessageRequestDto { private boolean anonymous; // entity -> dto - public MessageRequestDto(Messages messages) { - this.context = messages.getContext(); - this.receiver = messages.getReceiver(); - this.paperNum = messages.getPaperNum(); - this.anonymous = messages.isAnonymous(); - } - - public MessageRequestDto(String context, String receiver, - int paperNum, boolean anonymous) { - this.context = context; - this.receiver = receiver; - this.paperNum = paperNum; - this.anonymous = anonymous; - } +// public MessageRequestDto(Messages messages) { +// this.context = messages.getContext(); +// this.receiver = messages.getReceiver(); +// this.paperNum = messages.getPaperNum(); +// this.anonymous = messages.isAnonymous(); +// } +// +// public MessageRequestDto(String context, String receiver, +// int paperNum, boolean anonymous) { +// this.context = context; +// this.receiver = receiver; +// this.paperNum = paperNum; +// this.anonymous = anonymous; +// } } diff --git a/src/main/java/com/example/HappyNewHere/dto/response/MsgResponseDto.java b/src/main/java/com/example/HappyNewHere/dto/response/MsgResponseDto.java index ba15e7b..53d8688 100644 --- a/src/main/java/com/example/HappyNewHere/dto/response/MsgResponseDto.java +++ b/src/main/java/com/example/HappyNewHere/dto/response/MsgResponseDto.java @@ -13,10 +13,10 @@ public record MsgResponseDto( boolean anonymous, LocalDateTime day ) { - public static MsgResponseDto of(Messages messages, String senderNickname){ + public static MsgResponseDto of(Messages messages,String senderUserId, String senderNickname){ return new MsgResponseDto( messages.getContext(), - messages.getSender(), + senderUserId, senderNickname, messages.getPaperNum(), messages.isAnonymous(), diff --git a/src/main/java/com/example/HappyNewHere/exception/ErrorCode.java b/src/main/java/com/example/HappyNewHere/exception/ErrorCode.java index b7c314f..7ef52de 100644 --- a/src/main/java/com/example/HappyNewHere/exception/ErrorCode.java +++ b/src/main/java/com/example/HappyNewHere/exception/ErrorCode.java @@ -9,7 +9,7 @@ public enum ErrorCode { USER_NOT_FOUND(400,HttpStatus.NOT_FOUND, "유저를 찾을 수 없습니다"), INVALID_PERMISSION(401,HttpStatus.UNAUTHORIZED, "권한이 없습니다"), - DUPLICATED_USER_NAME(400,HttpStatus.CONFLICT, "유저명이 중복됩니다"), + DUPLICATED_USER_NAME(400,HttpStatus.CONFLICT, "유저명이 중복되거나 null일 수 있습니다."), DATABASE_ERROR(400,HttpStatus.INTERNAL_SERVER_ERROR, "DB에러가 발생하였습니다"); private int status; private HttpStatus error; diff --git a/src/main/java/com/example/HappyNewHere/repository/MessageRepository.java b/src/main/java/com/example/HappyNewHere/repository/MessageRepository.java index 8398423..99d4364 100644 --- a/src/main/java/com/example/HappyNewHere/repository/MessageRepository.java +++ b/src/main/java/com/example/HappyNewHere/repository/MessageRepository.java @@ -8,5 +8,5 @@ @Repository public interface MessageRepository extends JpaRepository { - List findByReceiver(String receiver); + List findByReceiver(Long receiver); } diff --git a/src/main/java/com/example/HappyNewHere/service/AccountService.java b/src/main/java/com/example/HappyNewHere/service/AccountService.java index 1025e89..d28c687 100644 --- a/src/main/java/com/example/HappyNewHere/service/AccountService.java +++ b/src/main/java/com/example/HappyNewHere/service/AccountService.java @@ -26,7 +26,7 @@ public class AccountService { private final AccountRepository accountRepository; @Value("${jwt.secret}") private String secretKey; - private Long expiredMs = 1000*60*60L; //한시간 + private Long expiredMs = 1000*60*60*24L; //한시간 @Transactional public Account save(AccountDto accountDto) { @@ -50,7 +50,7 @@ public AccountDto addUserId(Long accountId, String userId) { if(!account.isPresent()) throw new HappyException(ErrorCode.USER_NOT_FOUND); - if(!checkUserId(userId)) + if(!checkUserId(userId,account.get())) throw new HappyException(ErrorCode.DUPLICATED_USER_NAME); account.get().setUserId(userId); @@ -74,8 +74,10 @@ public String saveAccount(UserInfo userInfo){ account.setNickname(userInfo.getProperties().getNickname()); if (userInfo.getProperties().getProfile_image().equals("http://k.kakaocdn.net/dn/1G9kp/btsAot8liOn/8CWudi3uy07rvFNUkk3ER0/img_640x640.jpg")){ - - account.setProfileImg("https://dang-na-dong.s3.ap-northeast-2.amazonaws.com/Snowman.png"); + if (Math.random()>=0.5) + account.setProfileImg("https://dang-na-dong.s3.ap-northeast-2.amazonaws.com/Snowman.png"); + else + account.setProfileImg("https://dang-na-dong.s3.ap-northeast-2.amazonaws.com/Presents.png"); } else{ account.setProfileImg(userInfo.getProperties().getProfile_image()); @@ -104,23 +106,23 @@ public AccountDto updateAccount(Long accountId, AccountRequestDto accountRequest Optional account = accountRepository.findById(accountId); if(!account.isPresent()) throw new HappyException(ErrorCode.USER_NOT_FOUND); - if(!checkUserId(accountRequestDto.userId())) + //중복된 유저 확인 + if(!checkUserId(accountRequestDto.userId(),account.get())) throw new HappyException(ErrorCode.DUPLICATED_USER_NAME); - // 있다면 userId가 동일한지 확인하고 다르다면 예외 반환 - if(!account.get().getUserId().equals(accountRequestDto.userId())) - throw new HappyException(ErrorCode.INVALID_PERMISSION); - // 이미 존재하는 유저이며, userId가 동일하다면 해당 유저의 정보를 수정한다. - return AccountDto.from(accountRepository.save(Account.of(accountId, accountRequestDto))); + + return AccountDto.from(accountRepository.save(Account.of(accountId, accountRequestDto, account.get().getProfileImg()))); } - //userId 중복체크 - public boolean checkUserId(String userId){ - if(userId.equals(null) || userId.equals("")){ - return true; - } - if (accountRepository.findByUserId(userId).isPresent()) { + //수정될userId 중복체크 + public boolean checkUserId(String userId, Account owner){ + if(userId==null || userId.equals("")) return false; - } - return true; + Optional account = accountRepository.findByUserId(userId); + if (account.isEmpty()) + return true; + if(owner.getUserId().equals(userId)) + return true; + + return false; } } diff --git a/src/main/java/com/example/HappyNewHere/service/CalenderService.java b/src/main/java/com/example/HappyNewHere/service/CalenderService.java index 4ad7012..ba25027 100644 --- a/src/main/java/com/example/HappyNewHere/service/CalenderService.java +++ b/src/main/java/com/example/HappyNewHere/service/CalenderService.java @@ -5,6 +5,8 @@ import com.example.HappyNewHere.domain.Messages; import com.example.HappyNewHere.dto.CalenderDto; import com.example.HappyNewHere.dto.response.MsgResponseDto; +import com.example.HappyNewHere.exception.ErrorCode; +import com.example.HappyNewHere.exception.HappyException; import com.example.HappyNewHere.repository.AccountRepository; import com.example.HappyNewHere.repository.CalenderRepository; import com.example.HappyNewHere.repository.MessageRepository; @@ -42,11 +44,10 @@ public CalenderDto showCalender(Long accountId, String userId){ else calenderDto.setOwner(false); //3. 메세지 목록 담기(일치하는 멤버가 아니거나 25일이 아니면 null로 두기) - LocalDateTime now = LocalDateTime.now(); if(calenderDto.isOwner() - //&& now.getYear()==2024 + // && LocalDateTime.now().getYear()==2024 ){ - List messages = messageRepository.findByReceiver(userId); + List messages = messageRepository.findByReceiver(viewer.get().getAccountId()); for(Messages msg : messages){ calenderDto.getMessagesList().add(toMsgDto(msg)); } @@ -54,7 +55,9 @@ public CalenderDto showCalender(Long accountId, String userId){ return calenderDto; } public MsgResponseDto toMsgDto(Messages messages){ - return MsgResponseDto.of(messages,accountRepository.findByUserId(messages.getSender()).get().getNickname()); + Optional account = accountRepository.findById(messages.getSender()); + if (account.isEmpty()) throw new HappyException(ErrorCode.USER_NOT_FOUND); + return MsgResponseDto.of(messages,account.get().getUserId(),account.get().getNickname()); } diff --git a/src/main/java/com/example/HappyNewHere/service/MessageService.java b/src/main/java/com/example/HappyNewHere/service/MessageService.java index 551c5ed..5495d8e 100644 --- a/src/main/java/com/example/HappyNewHere/service/MessageService.java +++ b/src/main/java/com/example/HappyNewHere/service/MessageService.java @@ -1,73 +1,87 @@ package com.example.HappyNewHere.service; +import com.example.HappyNewHere.domain.Account; import com.example.HappyNewHere.domain.Messages; import com.example.HappyNewHere.dto.MessageDto; import com.example.HappyNewHere.dto.request.MessageRequestDto; +import com.example.HappyNewHere.exception.ErrorCode; +import com.example.HappyNewHere.exception.HappyException; +import com.example.HappyNewHere.repository.AccountRepository; import com.example.HappyNewHere.repository.MessageRepository; import com.example.HappyNewHere.utils.AuthenticateUtils; import jakarta.transaction.Transactional; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Optional; + import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @Service @RequiredArgsConstructor +@Transactional public class MessageService { private final MessageRepository messageRepository; + private final AccountRepository accountRepository; private final AuthenticateUtils authenticateUtils; // 메세지 생성 (Create) public MessageDto createMessage(String userId, MessageRequestDto messageRequestDto) { - Messages messages = new Messages(); - messages.setAnonymous(messageRequestDto.isAnonymous()); - messages.setCreatedDate(LocalDateTime.now()); - messages.setContext(messageRequestDto.getContext()); - messages.setReceiver(messageRequestDto.getReceiver()); - messages.setPaperNum(messageRequestDto.getPaperNum()); - messages.setSender(userId); - messageRepository.save(messages); - return new MessageDto(messages); - } - - // 내가 받은 메세지들 가져오기 (Read) - public List findAllMessages(String receiver) { - try{ - List messagesList = messageRepository.findByReceiver(receiver); - List messageDtoList = new ArrayList<>(); - for (Messages messages : messagesList) { - messageDtoList.add(new MessageDto(messages)); - } - return messageDtoList; - } catch (Exception e) { -// throw new DBEmptyDataException("조회 실패!"); - } - return null; - } + Optional sender = accountRepository.findByUserId(userId); + Optional receiver = accountRepository.findByUserId(messageRequestDto.getReceiver()); + if (sender.isEmpty()) throw new HappyException(ErrorCode.USER_NOT_FOUND); + if (receiver.isEmpty()) throw new HappyException(ErrorCode.USER_NOT_FOUND); - // 메세지 하나 가져오기 (Read) - public MessageDto findOneMessage(Long messageId) { - Messages messages = messageRepository.findById(messageId).orElseThrow( - () -> new IllegalArgumentException("조회 실패") + Messages messages = Messages.of( + LocalDateTime.now(), + messageRequestDto.getContext(), + sender.get().getAccountId(), + receiver.get().getAccountId(), + messageRequestDto.getPaperNum(), + messageRequestDto.isAnonymous() ); - return new MessageDto(messages); - } - - // 메세지 수정 (Update) - @Transactional - public Long updateMessage(MessageDto messageDto) { - Messages messages = messageRepository.findById(messageDto.getMessageId()).orElseThrow( - () -> new IllegalArgumentException("해당 메세지가 존재하지 않습니다.") - ); - messages.update(messageDto); - return messages.getMessageId(); + messageRepository.save(messages); + return MessageDto.from(messages,userId,messageRequestDto.getReceiver()); } - // 메세지 삭제 (Delete) - @Transactional - public Long deleteMessage(Long messageId) { - messageRepository.deleteById(messageId); - return messageId; - } + // 내가 받은 메세지들 가져오기 (Read) +// public List findAllMessages(String receiver) { +// try{ +// List messagesList = messageRepository.findByReceiver(receiver); +// List messageDtoList = new ArrayList<>(); +// for (Messages messages : messagesList) { +// messageDtoList.add(new MessageDto(messages)); +// } +// return messageDtoList; +// } catch (Exception e) { +//// throw new DBEmptyDataException("조회 실패!"); +// } +// return null; +// } +// +// // 메세지 하나 가져오기 (Read) +// public MessageDto findOneMessage(Long messageId) { +// Messages messages = messageRepository.findById(messageId).orElseThrow( +// () -> new IllegalArgumentException("조회 실패") +// ); +// return new MessageDto(messages); +// } +// +// // 메세지 수정 (Update) +// @Transactional +// public Long updateMessage(MessageDto messageDto) { +// Messages messages = messageRepository.findById(messageDto.getMessageId()).orElseThrow( +// () -> new IllegalArgumentException("해당 메세지가 존재하지 않습니다.") +// ); +// //messages.update(messageDto); +// return messages.getMessageId(); +// } +// +// // 메세지 삭제 (Delete) +// @Transactional +// public Long deleteMessage(Long messageId) { +// messageRepository.deleteById(messageId); +// return messageId; +// } } diff --git a/src/main/java/com/example/HappyNewHere/utils/AuthenticateUtils.java b/src/main/java/com/example/HappyNewHere/utils/AuthenticateUtils.java index 2fbb553..a74ae74 100644 --- a/src/main/java/com/example/HappyNewHere/utils/AuthenticateUtils.java +++ b/src/main/java/com/example/HappyNewHere/utils/AuthenticateUtils.java @@ -5,11 +5,8 @@ import com.example.HappyNewHere.exception.HappyException; import com.example.HappyNewHere.repository.AccountRepository; import java.util.Optional; -import lombok.AllArgsConstructor; import lombok.RequiredArgsConstructor; import org.springframework.security.core.Authentication; -import org.springframework.security.core.Transient; -import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; @Service @@ -30,7 +27,7 @@ public String getUserId(Authentication authentication){ public Long getLongId(Authentication authentication){ if (authentication==null) throw new HappyException(ErrorCode.USER_NOT_FOUND); Long accountId = Long.parseLong(authentication.getName()); - System.out.println(accountId); + return accountId; } diff --git a/src/main/resources/application-rds.yaml b/src/main/resources/application-rds.yaml index b38de52..0529474 100644 --- a/src/main/resources/application-rds.yaml +++ b/src/main/resources/application-rds.yaml @@ -6,5 +6,11 @@ spring: driver-class-name: org.mariadb.jdbc.Driver username: ${RDS_USERNAME} password: ${RDS_PASSWORD} + hikari: + connection-timeout: 300 + validation-timeout: 300 + minimum-idle: 3 + max-lifetime: 180 + maximum-pool-size: 20 ## \ No newline at end of file diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 49e77c6..c9af509 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -7,5 +7,4 @@ spring: generate-ddl: true show-sql: true hibernate: - ddl-auto: update - ## \ No newline at end of file + ddl-auto: update \ No newline at end of file