-
[Spring] Bean을 생성하는 방법JAVA/Spring(Springboot) 2021. 7. 18. 15:00728x90
Bean을 생성하는 방법은 크게 두가지가 있다
첫번째는 AppConfig.class 를 사용하여 Factory Bean을 통해서 생성하는 방식이 있다
AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(AppConfig.class);
두번째는 XML을 사용하여 직접적으로 빈을 생성하는 방식이 있다
ApplicationContext ac = new GenericXmlApplicationContext("appConfig.xml");
728x90728x90'JAVA > Spring(Springboot)' 카테고리의 다른 글
[Spring] 롬복 라이브러리 / 설치 및 사용법 (0) 2021.07.23 [Spring] 빈이 충돌나는 경우 (0) 2021.07.21 [Spring] Bean 객체 가져오기 (0) 2021.07.17 스프링 컨테이너에 등록된 모든 빈 조회 (0) 2021.07.17