본문 바로가기
Programming/Spring Boot

생성된 빈 접근방법

by yoon9i 2024. 7. 2.

8. 생성된 빈 접근하는 방법

  ApplicationContext ctx;

  public 생성자(ApplicationContext ctx) {
    this.ctx = ctx;
  }

  또는

  @Autowired
  ApplicationContext ctx;

  ctx.getBean("xxx", 클래스명.class); // @Service("xxx") public class DeptServiceImpl

'Programming > Spring Boot' 카테고리의 다른 글

초기화 및 cleanup 작업 처리(@PostConstruct & @PreDestroy)  (0) 2024.07.02
빈의 scope  (0) 2024.07.02
의존성 설정  (0) 2024.07.02
빈(Bean) 생성  (0) 2024.07.02
로깅처리  (0) 2024.07.02