use of cn.taketoday.context.LifecycleProcessor in project today-framework by TAKETODAY.
the class DefaultLifecycleProcessorTests method customLifecycleProcessorInstance.
@Test
public void customLifecycleProcessorInstance() {
BeanDefinition beanDefinition = new RootBeanDefinition(DefaultLifecycleProcessor.class);
beanDefinition.getPropertyValues().add("timeoutPerShutdownPhase", 1000);
StaticApplicationContext context = new StaticApplicationContext();
context.registerBeanDefinition("lifecycleProcessor", beanDefinition);
context.refresh();
LifecycleProcessor bean = context.getBean("lifecycleProcessor", LifecycleProcessor.class);
Object contextLifecycleProcessor = new DirectFieldAccessor(context).getPropertyValue("lifecycleProcessor");
assertThat(contextLifecycleProcessor).isNotNull();
assertThat(contextLifecycleProcessor).isSameAs(bean);
assertThat(new DirectFieldAccessor(contextLifecycleProcessor).getPropertyValue("timeoutPerShutdownPhase")).isEqualTo(1000L);
}
use of cn.taketoday.context.LifecycleProcessor in project today-infrastructure by TAKETODAY.
the class DefaultLifecycleProcessorTests method customLifecycleProcessorInstance.
@Test
public void customLifecycleProcessorInstance() {
BeanDefinition beanDefinition = new RootBeanDefinition(DefaultLifecycleProcessor.class);
beanDefinition.getPropertyValues().add("timeoutPerShutdownPhase", 1000);
StaticApplicationContext context = new StaticApplicationContext();
context.registerBeanDefinition("lifecycleProcessor", beanDefinition);
context.refresh();
LifecycleProcessor bean = context.getBean("lifecycleProcessor", LifecycleProcessor.class);
Object contextLifecycleProcessor = new DirectFieldAccessor(context).getPropertyValue("lifecycleProcessor");
assertThat(contextLifecycleProcessor).isNotNull();
assertThat(contextLifecycleProcessor).isSameAs(bean);
assertThat(new DirectFieldAccessor(contextLifecycleProcessor).getPropertyValue("timeoutPerShutdownPhase")).isEqualTo(1000L);
}
Aggregations