@Service
Artifact
- org.springframework.stereotype
역할
- java 비즈니스 로직을 구현하는 Class를 명시
- 저장소 계층을 사용
사용법
@Service
public class BeanUtil implements ApplicationContextAware {
private static ApplicationContext context;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
context = applicationContext;
}
public static <T> T getBean(Class<T> beanClass) {
return context.getBean(beanClass);
}
}
댓글남기기