From c0725a42fd0787c1cb242b296e20720a330a2db4 Mon Sep 17 00:00:00 2001 From: nwar-Jeon Date: Tue, 3 Dec 2019 15:53:10 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B3=80=EC=88=98=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EB=B0=8D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dsm/java/taxipot_backend/socket/SocketHandler.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/kr/hs/dsm/java/taxipot_backend/socket/SocketHandler.java b/src/main/java/kr/hs/dsm/java/taxipot_backend/socket/SocketHandler.java index 9bc1a38..c6df870 100644 --- a/src/main/java/kr/hs/dsm/java/taxipot_backend/socket/SocketHandler.java +++ b/src/main/java/kr/hs/dsm/java/taxipot_backend/socket/SocketHandler.java @@ -4,7 +4,6 @@ import kr.hs.dsm.java.taxipot_backend.repository.UserRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.socket.CloseStatus; import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.WebSocketSession; @@ -14,13 +13,13 @@ public class SocketHandler extends TextWebSocketHandler { - UserRepository repository; + UserRepository userRepository; SocketRepository socketRepo; Logger logger = LoggerFactory.getLogger(SocketHandler.class); public SocketHandler(UserRepository repository, SocketRepository socketRepo) { - this.repository = repository; + this.userRepository = repository; this.socketRepo = socketRepo; } @@ -92,7 +91,7 @@ private String[] splitMessage(TextMessage message, String regex) { private void disconnect(WebSocketSession session, int room_id, String userId) { //TODO DB에서 USER.ROOMID, SEATNUM 삭제 작업 해줘야함. socketRepo.getSocketMap().get(room_id).onClose(session); - applyUserChange(removeSocketInfoOnUser(repository.findById(userId))); + applyUserChange(removeSocketInfoOnUser(userRepository.findById(userId))); } private User removeSocketInfoOnUser(Optional userOptional) { @@ -109,7 +108,7 @@ private void applyUserChange(User user) { if(user==null) { return; } - repository.save(user); + userRepository.save(user); } }