You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by so...@apache.org on 2023/09/27 15:44:52 UTC
[wicket] branch master updated: [WICKET-7077] no need to re-create global spring context (#665)
This is an automated email from the ASF dual-hosted git repository.
solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git
The following commit(s) were added to refs/heads/master by this push:
new 933b0d52d5 [WICKET-7077] no need to re-create global spring context (#665)
933b0d52d5 is described below
commit 933b0d52d53a5daa3ca8fa7511081a8e7c4c978d
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Wed Sep 27 22:44:46 2023 +0700
[WICKET-7077] no need to re-create global spring context (#665)
---
.../wicket/spring/SpringWebApplicationFactory.java | 40 ++++++++--------------
1 file changed, 14 insertions(+), 26 deletions(-)
diff --git a/wicket-spring/src/main/java/org/apache/wicket/spring/SpringWebApplicationFactory.java b/wicket-spring/src/main/java/org/apache/wicket/spring/SpringWebApplicationFactory.java
index f5b1476ddc..4d4da3166b 100644
--- a/wicket-spring/src/main/java/org/apache/wicket/spring/SpringWebApplicationFactory.java
+++ b/wicket-spring/src/main/java/org/apache/wicket/spring/SpringWebApplicationFactory.java
@@ -18,7 +18,6 @@ package org.apache.wicket.spring;
import java.util.Map;
-import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletContext;
import org.apache.wicket.protocol.http.IWebApplicationFactory;
@@ -36,9 +35,9 @@ import org.springframework.web.context.support.XmlWebApplicationContext;
/**
* Implementation of IWebApplicationFactory that pulls the WebApplication object out of spring
* application context.
- *
+ *
* Configuration example:
- *
+ *
* <pre>
* <filter>
* <filter-name>MyApplication</filter-name>
@@ -49,12 +48,12 @@ import org.springframework.web.context.support.XmlWebApplicationContext;
* </init-param>
* </filter>
* </pre>
- *
+ *
* <code>applicationBean</code> init parameter can be used if there are multiple WebApplications
* defined on the spring application context.
- *
+ *
* Example:
- *
+ *
* <pre>
* <filter>
* <filter-name>MyApplication</filter-name>
@@ -69,13 +68,13 @@ import org.springframework.web.context.support.XmlWebApplicationContext;
* </init-param>
* </filter>
* </pre>
- *
+ *
* <p>
* This factory is also capable of creating a {@link WebApplication}-specific application context
* (path to which is specified via the {@code contextConfigLocation} filter param) and chaining it
* to the global one
* </p>
- *
+ *
* <pre>
* <filter>
* <filter-name>MyApplication</filter-name>
@@ -90,10 +89,10 @@ import org.springframework.web.context.support.XmlWebApplicationContext;
* </init-param>
* </filter>
* </pre>
- *
+ *
* @author Igor Vaynberg (ivaynberg)
* @author Janne Hietamäki (jannehietamaki)
- *
+ *
*/
public class SpringWebApplicationFactory implements IWebApplicationFactory
{
@@ -104,30 +103,19 @@ public class SpringWebApplicationFactory implements IWebApplicationFactory
/**
* Returns location of context config that will be used to create a {@link WebApplication}
* -specific application context.
- *
+ *
* @param filter
* @return location of context config
*/
protected final String getContextConfigLocation(final WicketFilter filter)
{
- String contextConfigLocation;
-
- final FilterConfig filterConfig = filter.getFilterConfig();
- contextConfigLocation = filterConfig.getInitParameter("contextConfigLocation");
-
- if (contextConfigLocation == null)
- {
- final ServletContext servletContext = filterConfig.getServletContext();
- contextConfigLocation = servletContext.getInitParameter("contextConfigLocation");
- }
-
- return contextConfigLocation;
+ return filter.getFilterConfig().getInitParameter("contextConfigLocation");
}
/**
* Factory method used to create a new instance of the web application context, by default an
* instance of {@link XmlWebApplicationContext} will be created.
- *
+ *
* @return application context instance
*/
protected ConfigurableWebApplicationContext newApplicationContext()
@@ -191,7 +179,7 @@ public class SpringWebApplicationFactory implements IWebApplicationFactory
/**
* Creates and initializes a new {@link WebApplicationContext}, with the given context as the
* parent. Based on the logic in Spring's FrameworkServlet#createWebApplicationContext()
- *
+ *
* @param parent
* parent application context
* @param filter
@@ -216,7 +204,7 @@ public class SpringWebApplicationFactory implements IWebApplicationFactory
/**
* This is a hook for potential subclasses to perform additional processing on the context.
* Based on the logic in Spring's FrameworkServlet#postProcessWebApplicationContext()
- *
+ *
* @param wac
* additional application context
* @param filter