private ConditionOutcome isWebApplication(ConditionContext context,
AnnotatedTypeMetadata metadata) {
if (!ClassUtils.isPresent(WEB_CONTEXT_CLASS, context.getClassLoader())) {
return ConditionOutcome.noMatch("web application classes not found");
}
if (context.getBeanFactory() != null) {
String[] scopes = context.getBeanFactory().getRegisteredScopeNames();
if (ObjectUtils.containsElement(scopes, "session")) {
return ConditionOutcome.match("found web application 'session' scope");
}
}
if (context.getEnvironment() instanceof StandardServletEnvironment) {
return ConditionOutcome
.match("found web application StandardServletEnvironment");
}
if (context.getResourceLoader() instanceof WebApplicationContext) {
return ConditionOutcome.match("found web application WebApplicationContext");
}
return ConditionOutcome.noMatch("not a web application");
}
OnWebApplicationCondition.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:spring-boot-concourse
作者:
评论列表
文章目录