Pass classloader to ClassUtils.isPresent().

Fixes deprecation warnings when compiling against Spring 3.2.x and fixes
runtime errors when using Spring Web Flow with Spring 4.0.0.M1.

SWF-1600
This commit is contained in:
Craig Walls
2013-06-19 17:01:34 -05:00
parent 93dc89ed5b
commit 853372e540
2 changed files with 3 additions and 3 deletions

View File

@@ -35,7 +35,7 @@ import org.springframework.webflow.mvc.view.FlowViewResolver;
*/
public class FlowResourceFlowViewResolver implements FlowViewResolver {
private static final boolean JSTL_PRESENT = ClassUtils.isPresent("javax.servlet.jsp.jstl.fmt.LocalizationContext");
private static final boolean JSTL_PRESENT = ClassUtils.isPresent("javax.servlet.jsp.jstl.fmt.LocalizationContext", FlowResourceFlowViewResolver.class.getClassLoader());
private String defaultViewSuffix = ".jsp";

View File

@@ -43,7 +43,7 @@ public enum MvcEnvironment {
* @return the web environment the context is running in, or null if not running in a web environment
*/
public static MvcEnvironment environmentFor(ApplicationContext applicationContext) {
if (ClassUtils.isPresent("javax.portlet.PortletContext") && isPortletApplicationContext(applicationContext)) {
if (ClassUtils.isPresent("javax.portlet.PortletContext", MvcEnvironment.class.getClassLoader()) && isPortletApplicationContext(applicationContext)) {
return MvcEnvironment.PORTLET;
} else if (applicationContext instanceof WebApplicationContext) {
return MvcEnvironment.SERVLET;
@@ -53,7 +53,7 @@ public enum MvcEnvironment {
}
private static boolean isPortletApplicationContext(ApplicationContext applicationContext) {
return ClassUtils.isPresent("org.springframework.web.portlet.context.ConfigurablePortletApplicationContext")
return ClassUtils.isPresent("org.springframework.web.portlet.context.ConfigurablePortletApplicationContext", MvcEnvironment.class.getClassLoader())
&& applicationContext instanceof ConfigurablePortletApplicationContext;
}