You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Class.forName()= 지연 로딩자바에서의 클래스 로딩시점
MyClass.class→ 컴파일 시점에 명확히 결정되므로, JVM이 실행될 때 바로 로딩됨 (정적 로딩)
new MyClass()→ 생성 시점에 클래스도 함께 로딩됨
Class.forName("com.example.MyClass")→ 문자열이 처리되는 시점에 로딩됨, 즉 명시적으로 호출하기 전까지는 JVM이 해당 클래스를 로딩하지 않음
지연 로딩이란?
지연 로딩이 유용한 상황 예시
조건부 기능 활성화
featureEnabled가false면,ExperimentalFeature는 아예 JVM에 로딩되지 않음.플러그인 구조
JDBC 드라이버 등록 (옛날 방식)
주의할 점
ClassNotFoundException정리
Beta Was this translation helpful? Give feedback.
All reactions