Java
-
[spring] IntelliJ Cannot resolve symbol 'persistence'spring 2023. 3. 27. 21:19
스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술 분명 강의자료를 그대로 복붙했음에도 오류가 생겼다. [오류 코드] package hello.hellospring.repository; import hello.hellospring.domain.Member; import javax.persistence.EntityManager; import java.util.List; import java.util.Optional; public class JpaMemberRepository implements MemberRepository { private final EntityManager em; public JpaMemberRepository(EntityManager em) { this.em = ..
-
[spring/java] hashmap, ConcurrnetHashMap, HashTable의 차이spring 2023. 3. 21. 16:44
강의에서 hashmap 대신 concurrentHashmap을 사용하는 것을 권장하기에 관련 내용을 찾아보게 되었다. 1. HashMap - 사용 방법 HashMap 변수명 = new HashMap(); Collections.synchornizedMap(HashMap) // 동기화를 할 수 있도록 변경시킬 수 있음 - 특징 ▶ 동기화되지 않으므로 스레드로부터 안전하지 않다.(synchornizedMap를 이용하여 동기화 할 수 있다.) ▶ 단일 스레드에 유리하다. ▶ 응용 프로그램의 CPU 사용량이 급증할 가능성이 높다. ▶ 속도가 빠르다. ▶ 메모리 누수나 원치않은 데이터가 조회되는 문제가 발생할 수 있다. 2. ConcurrnetHashMap - 사용 방법 Map map = new Concurrent..