From 853372e54002b83c34d1e91d514ad1a99c541941 Mon Sep 17 00:00:00 2001 From: Craig Walls Date: Wed, 19 Jun 2013 17:01:34 -0500 Subject: [PATCH] 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 --- .../webflow/mvc/builder/FlowResourceFlowViewResolver.java | 2 +- .../springframework/webflow/mvc/builder/MvcEnvironment.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/builder/FlowResourceFlowViewResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/builder/FlowResourceFlowViewResolver.java index da0f9923..2f136567 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/builder/FlowResourceFlowViewResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/builder/FlowResourceFlowViewResolver.java @@ -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"; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/builder/MvcEnvironment.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/builder/MvcEnvironment.java index a2de6d0c..d5c9db86 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/builder/MvcEnvironment.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/builder/MvcEnvironment.java @@ -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; }