Remove unused deduceFromApplicationContext and supporting code
Closes gh-31218
This commit is contained in:
parent
0b6c147a87
commit
348662b15e
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -54,10 +54,6 @@ public enum WebApplicationType {
|
||||||
|
|
||||||
private static final String JERSEY_INDICATOR_CLASS = "org.glassfish.jersey.servlet.ServletContainer";
|
private static final String JERSEY_INDICATOR_CLASS = "org.glassfish.jersey.servlet.ServletContainer";
|
||||||
|
|
||||||
private static final String SERVLET_APPLICATION_CONTEXT_CLASS = "org.springframework.web.context.WebApplicationContext";
|
|
||||||
|
|
||||||
private static final String REACTIVE_APPLICATION_CONTEXT_CLASS = "org.springframework.boot.web.reactive.context.ReactiveWebApplicationContext";
|
|
||||||
|
|
||||||
static WebApplicationType deduceFromClasspath() {
|
static WebApplicationType deduceFromClasspath() {
|
||||||
if (ClassUtils.isPresent(WEBFLUX_INDICATOR_CLASS, null) && !ClassUtils.isPresent(WEBMVC_INDICATOR_CLASS, null)
|
if (ClassUtils.isPresent(WEBFLUX_INDICATOR_CLASS, null) && !ClassUtils.isPresent(WEBMVC_INDICATOR_CLASS, null)
|
||||||
&& !ClassUtils.isPresent(JERSEY_INDICATOR_CLASS, null)) {
|
&& !ClassUtils.isPresent(JERSEY_INDICATOR_CLASS, null)) {
|
||||||
|
|
@ -71,23 +67,4 @@ public enum WebApplicationType {
|
||||||
return WebApplicationType.SERVLET;
|
return WebApplicationType.SERVLET;
|
||||||
}
|
}
|
||||||
|
|
||||||
static WebApplicationType deduceFromApplicationContext(Class<?> applicationContextClass) {
|
|
||||||
if (isAssignable(SERVLET_APPLICATION_CONTEXT_CLASS, applicationContextClass)) {
|
|
||||||
return WebApplicationType.SERVLET;
|
|
||||||
}
|
|
||||||
if (isAssignable(REACTIVE_APPLICATION_CONTEXT_CLASS, applicationContextClass)) {
|
|
||||||
return WebApplicationType.REACTIVE;
|
|
||||||
}
|
|
||||||
return WebApplicationType.NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isAssignable(String target, Class<?> type) {
|
|
||||||
try {
|
|
||||||
return ClassUtils.resolveClassName(target, null).isAssignableFrom(type);
|
|
||||||
}
|
|
||||||
catch (Throwable ex) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue