annotation1 [IntelliJ_MariaDB] Try-with-resource, Annotation, @ToString, @Data, @Builder, @NoArgsConstructor, @AllArgsConstructor, ModelMapper 1. Try-with-resourse 구문 try(Connection conn = ConnectionUtil.INSTANCE.getConnection(); PreparedStatement pstmt = conn.prepareStatement("select now()"); ResultSet rs = pstmt.executeQuery();){ rs.next(); now = rs.getString(1);}catch(SQLException e){ e.printStackTrace();}소괄호 안에서 자원을 할당하고 중괄호가 끝나면 자동으로 리소스를 닫아줍니다.따라서 finally구문에서 수동으로 close할 필요가 없습니다. public String .. Coding 공부/IntelliJ 2024. 4. 24. 이전 1 다음 728x90 반응형