Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
56f5b3ad
Commit
56f5b3ad
authored
Aug 12, 2013
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logging to dispatcher servlet condition
parent
0af9d202
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
EmbeddedServletContainerAutoConfiguration.java
...figure/web/EmbeddedServletContainerAutoConfiguration.java
+23
-0
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java
View file @
56f5b3ad
...
...
@@ -21,6 +21,8 @@ import java.util.Arrays;
import
javax.servlet.Servlet
;
import
org.apache.catalina.startup.Tomcat
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.eclipse.jetty.server.Server
;
import
org.eclipse.jetty.util.Loader
;
import
org.springframework.beans.BeansException
;
...
...
@@ -31,6 +33,7 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import
org.springframework.beans.factory.support.BeanDefinitionRegistry
;
import
org.springframework.beans.factory.support.RootBeanDefinition
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.condition.ConditionLogUtils
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.SearchStrategy
;
...
...
@@ -148,19 +151,39 @@ public class EmbeddedServletContainerAutoConfiguration {
private
static
class
DefaultServletCondition
implements
Condition
{
private
static
Log
logger
=
LogFactory
.
getLog
(
DefaultServletCondition
.
class
);
@Override
public
boolean
matches
(
ConditionContext
context
,
AnnotatedTypeMetadata
metadata
)
{
String
checking
=
ConditionLogUtils
.
getPrefix
(
logger
,
metadata
);
ConfigurableListableBeanFactory
beanFactory
=
context
.
getBeanFactory
();
String
[]
beans
=
beanFactory
.
getBeanNamesForType
(
DispatcherServlet
.
class
,
false
,
false
);
if
(
beans
.
length
==
0
)
{
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
checking
+
"No DispatcherServlet found (search terminated with matches=true)"
);
}
// No dispatcher servlet so no need to ask further questions
return
true
;
}
if
(
Arrays
.
asList
(
beans
).
contains
(
DEFAULT_DISPATCHER_SERVLET_BEAN_NAME
))
{
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
checking
+
"DispatcherServlet found and named "
+
DEFAULT_DISPATCHER_SERVLET_BEAN_NAME
+
" (search terminated with matches=false)"
);
}
// An existing bean with the default name
return
false
;
}
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
checking
+
"Multiple DispatcherServlets found and none is named "
+
DEFAULT_DISPATCHER_SERVLET_BEAN_NAME
+
" (search terminated with matches=true)"
);
}
return
true
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment