Detect Tomcat start failures
Detect if the tomcat container fails to start and propagate an exception to the caller.
This commit is contained in:
@@ -24,7 +24,6 @@ import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.boot.TestUtils;
|
||||
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext;
|
||||
@@ -35,6 +34,7 @@ import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory
|
||||
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
|
||||
import org.springframework.boot.context.embedded.properties.ServerProperties;
|
||||
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||
import org.springframework.context.ApplicationContextException;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -133,7 +133,7 @@ public class ServerPropertiesAutoConfigurationTests {
|
||||
this.context.register(Config.class, MutiServerPropertiesBeanConfig.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.thrown.expect(BeanCreationException.class);
|
||||
this.thrown.expect(ApplicationContextException.class);
|
||||
this.thrown.expectMessage("Multiple ServerProperties");
|
||||
this.context.refresh();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user