You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by ts...@apache.org on 2017/02/27 05:29:06 UTC
wicket-site git commit: Servlet 3.x with Spring Framework example
Repository: wicket-site
Updated Branches:
refs/heads/asf-site 26fcaca36 -> 3708504ee
Servlet 3.x with Spring Framework example
- Moved context init into static method
Project: http://git-wip-us.apache.org/repos/asf/wicket-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket-site/commit/3708504e
Tree: http://git-wip-us.apache.org/repos/asf/wicket-site/tree/3708504e
Diff: http://git-wip-us.apache.org/repos/asf/wicket-site/diff/3708504e
Branch: refs/heads/asf-site
Commit: 3708504eef1757c828e8a0019a6eb47d9ec75682
Parents: 26fcaca
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Mon Feb 27 06:28:18 2017 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Mon Feb 27 06:28:18 2017 +0100
----------------------------------------------------------------------
learn/examples/servlet3x.md | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket-site/blob/3708504e/learn/examples/servlet3x.md
----------------------------------------------------------------------
diff --git a/learn/examples/servlet3x.md b/learn/examples/servlet3x.md
index 3cd3daf..b34f5e8 100644
--- a/learn/examples/servlet3x.md
+++ b/learn/examples/servlet3x.md
@@ -38,21 +38,22 @@ example. You have to place them into the scanned package or in sub packages. (co
{% highlight java %}
import javax.servlet.annotation.WebListener;
import org.springframework.web.context.ContextLoaderListener;
+import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
@WebListener
public class MyContextLoaderListener extends ContextLoaderListener {
- private static AnnotationConfigWebApplicationContext context;
+ public MyContextLoaderListener() {
+ super(getWebApplicationContext());
+ }
- static {
- context = new AnnotationConfigWebApplicationContext();
+ private static WebApplicationContext getWebApplicationContext() {
+ AnnotationConfigWebApplicationContext context
+ = new AnnotationConfigWebApplicationContext();
context.scan("com.my.package");
context.refresh();
- }
-
- public MyContextLoaderListener() {
- super(context);
+ return context;
}
}
{% endhighlight %}