singleton

    [Spring] 스프링 핵심 원리 기본편 - 5. 싱글톤 컨테이너

    5. 싱글톤 컨테이너 웹 애플리케이션과 싱글톤 대부분 스프링 애플리케이션은 웹 애플리케이션 웹 애플리케이션은 보통 여러 고객이 동시에 요청을 한다 스프링 없는 순수한 DI 컨테이너 AppConfig: 요청을 할 때마다 객체가 새로 생성 해결 방안: 객체가 1개만 생성, 생성된 객체 인스턴스를 공유해서 쓰기 싱글톤 패턴 객체 인스턴스를 2개 이상 생성하지 못하도록 막기 package hello.core.singleton; public class SingletonService { private static final SingletonService instance = new SingletonService(); private SingletonService() { } public static SingletonSe..

출처: https://gmnam.tistory.com/157 [Voyager:티스토리]