Refactor ServletComponentRegisteringPostProcessor

Rework ServletComponentRegisteringPostProcessor to break the direct link
to the `org.springframework.boot.context.embedded` package.

See gh-5822
pull/5816/merge
Phillip Webb 9 years ago
parent 9153ca9526
commit 3de48d2603

@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2016 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.
@ -26,11 +26,11 @@ import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.boot.context.embedded.EmbeddedWebApplicationContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
import org.springframework.context.annotation.ScannedGenericBeanDefinition;
import org.springframework.web.context.WebApplicationContext;
/**
* {@link BeanFactoryPostProcessor} that registers beans for Servlet components found via
@ -87,8 +87,8 @@ class ServletComponentRegisteringPostProcessor
}
private boolean isRunningInEmbeddedContainer() {
return this.applicationContext instanceof EmbeddedWebApplicationContext
&& ((EmbeddedWebApplicationContext) this.applicationContext)
return this.applicationContext instanceof WebApplicationContext
&& ((WebApplicationContext) this.applicationContext)
.getServletContext() == null;
}

Loading…
Cancel
Save