패키지 com.example.ssm.util; 수입 org.springframework.beans.BeansException; 수입 org.springframework.context.ApplicationContext; 수입 org.springframework.context.ApplicationContextAware; 수입 org.springframework.stereotype.Component; @Component 공용 클래스 SpringContextUtil은 ApplicationContextAware {구현 개인 정적의 ApplicationContext ApplicationContext를 = NULL을; @Override 공개 공극 setApplicationContext (ApplicationContext를 애플리케이션 컨텍스트는) BeansException를 발생 { this.applicationContext = 애플리케이션 컨텍스트; } 공공 정적의 ApplicationContext getApplicationContext는 () { 애플리케이션 컨텍스트를 복귀; } 공공 정적 객체의 getBean (문자열 beanName에) { applicationContext.getBean (beanName에)을 반환; } 공공 정적 객체의 getBean (클래스 C) { applicationContext.getBean (c)를 반환; } }