본문 바로가기

Java47

spring-boot Controller Mock Testcase 작성 spring boot controller test (mock 버전) java source import org.example.online.domain.SampleIO; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @RestController public class SampleController { @Request.. 2020. 9. 5.
java gc 모니터링 (jstat) jstat 사용해서 gc 모니터링 환경 구성 public class JStatTest { public static void main(String[] args) throws Exception { System.out.println("sleep 1000 * 1000"); Thread.sleep(1000 * 1000); } } JStat 사용 방법 위에 소스를 gradle build 한 후, java -cp xxx.jar JStatTest 실행 시켜줌. jps 를 치면 JStatTest 에 대한 vmid 가 나옴. 그걸 아래 vmid 에 입력 Jstat -gcutil 1000 1초마다 gc 모니터링 정보를 콘솔에 출력 JStat 중요 컬럼 설명 YGC Minor GC 횟수 YGCT Minor GC 누적 시간 F.. 2020. 8. 29.
Java hashmap 설명 hashMap 과 hashcode 의 동작 원리 hashMap 에서 get, put 할 때, hashCode 함수를 호출해서 해시 값을 얻어서 key 로 사용. static final int hash(Object key) { int h; return (key == null) ? 0 : (h = key.hashCode()) ^ (h >>> 16); } public V get(Object key) { Node e; return (e = getNode(hash(key), key)) == null ? null : e.value; } public V put(K key, V value) { return putVal(hash(key), key, value, false, true); } hashcode 아래와 같이 구.. 2020. 8. 27.
java utils date to string (date 타입을 string 변환) 추후 볼 용도로 정리했습니다. java date 타입을 string 으로 변환 source, test code 둘 다 업로드 2020. 8. 13.