Commit 3c4f1a7a authored by Dave Syer's avatar Dave Syer

Fixes #54: stop servlet container if context fails to start

parent 97af88a8
......@@ -16,7 +16,6 @@
package org.springframework.boot.context.embedded;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.context.annotation.AnnotatedBeanDefinitionReader;
......@@ -188,9 +187,4 @@ public class AnnotationConfigEmbeddedWebApplicationContext extends
}
}
@Override
public final void refresh() throws BeansException, IllegalStateException {
super.refresh();
}
}
......@@ -35,6 +35,7 @@ import javax.servlet.ServletException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextException;
......@@ -114,6 +115,17 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
beanFactory.ignoreDependencyInterface(ServletContextAware.class);
}
@Override
public final void refresh() throws BeansException, IllegalStateException {
try {
super.refresh();
}
catch (RuntimeException e) {
stopAndReleaseEmbeddedServletContainer();
throw e;
}
}
@Override
protected void onRefresh() {
super.onRefresh();
......
......@@ -16,7 +16,6 @@
package org.springframework.boot.context.embedded;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.io.ClassPathResource;
......@@ -132,8 +131,4 @@ public class XmlEmbeddedWebApplicationContext extends EmbeddedWebApplicationCont
this.reader.loadBeanDefinitions(resources);
}
@Override
public final void refresh() throws BeansException, IllegalStateException {
super.refresh();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment