DefaultLifecycleProcessor properly handles count for dependent beans

Issue: SPR-16901
This commit is contained in:
Juergen Hoeller
2018-06-06 21:25:26 +02:00
parent 0941081b0a
commit 6cf197864c
3 changed files with 24 additions and 22 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@ package org.springframework.scheduling.quartz;
import org.junit.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.util.StopWatch;
@@ -32,7 +32,8 @@ public class QuartzSchedulerLifecycleTests {
@Test // SPR-6354
public void destroyLazyInitSchedulerWithDefaultShutdownOrderDoesNotHang() {
AbstractApplicationContext context = new ClassPathXmlApplicationContext("quartzSchedulerLifecycleTests.xml", this.getClass());
ConfigurableApplicationContext context =
new ClassPathXmlApplicationContext("quartzSchedulerLifecycleTests.xml", getClass());
assertNotNull(context.getBean("lazyInitSchedulerWithDefaultShutdownOrder"));
StopWatch sw = new StopWatch();
sw.start("lazyScheduler");
@@ -44,7 +45,8 @@ public class QuartzSchedulerLifecycleTests {
@Test // SPR-6354
public void destroyLazyInitSchedulerWithCustomShutdownOrderDoesNotHang() {
AbstractApplicationContext context = new ClassPathXmlApplicationContext("quartzSchedulerLifecycleTests.xml", this.getClass());
ConfigurableApplicationContext context =
new ClassPathXmlApplicationContext("quartzSchedulerLifecycleTests.xml", getClass());
assertNotNull(context.getBean("lazyInitSchedulerWithCustomShutdownOrder"));
StopWatch sw = new StopWatch();
sw.start("lazyScheduler");

View File

@@ -4,9 +4,15 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="lazyInitSchedulerWithDefaultShutdownOrder" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" lazy-init="true"/>
<bean id="otherSchedulerWithDefaultShutdownOrder" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="autoStartup" value="false"/>
</bean>
<bean id="lazyInitSchedulerWithCustomShutdownOrder" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" lazy-init="true">
<bean id="lazyInitSchedulerWithDefaultShutdownOrder" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
lazy-init="true" depends-on="otherSchedulerWithDefaultShutdownOrder"/>
<bean id="lazyInitSchedulerWithCustomShutdownOrder" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
lazy-init="true">
<property name="phase" value="99"/>
</bean>