Whiteship
  • Home
  • 인프런 강의
  • Java
  • Spring
  • JPA
  • SDE Tips
Subscribe

BeanLifeCycle

A collection of 2 posts
@Autowired

BeanLifeCycle 인터페이스를 없애보자.

BeanLifeCycle [http://whiteship.me/791]에 등장하는 여러 인터페이스 들 중에서 BeanFactoryAware, ApplicationContextAware, MessageSoruceAware, ApplicationEventPublisherAware, ResourceLoaderAware 인터페이스를 사용하지 않고도 이들이 해주는 일과 똑같은 작업을 할 수 있습니다. @Component public class Bean { @Autowired ApplicationContext applicationContext; @Autowired MessageSource messageSource; @Autowired ApplicationEventPublisher applicationEventPublisher; @Autowired ResourceLoader resourceLoader; @Autowired BeanFactory beanFactory; } 이런식으로
Sep 22, 2008 — 1 min read
BeanLifeCycle

BeanNameAware 테스트

public class BeanLifeCycleTestBean implements BeanNameAware{ String beanName; public void setBeanName(String beanName) { this.beanName = beanName; } public String getBeanName(){ return beanName; } } 위와 같이 BeanNameAware 클레스를 구현해 놓고 다음과 같이 간단히 Bean으로 등록합니다. 테스트 코드를 다음과 같이 작성하고 돌려보면… public class BeanLifeCycleTest { private ApplicationContext context; @Test public void testBeanNameAware() { context = ne
May 9, 2007 — 2 min read
Whiteship © 2022
Powered by Ghost