Author: ivaynberg
Date: Sat Apr 12 12:26:00 2008
New Revision: 647493
URL: http://svn.apache.org/viewvc?rev=647493&view=rev
Log:
wip: WICKET-1522 merge spring and spring-annot modules
Removed:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/direct/web/
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/proxy/web/
Modified:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/annot/web/AnnotPage.html
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/common/web/ExampleApplication.java
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/common/web/HomePage.html
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/common/web/HomePage.java
Modified:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/annot/web/AnnotPage.html
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/annot/web/AnnotPage.html?rev=647493&r1=647492&r2=647493&view=diff
==============================================================================
---
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/annot/web/AnnotPage.html
(original)
+++
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/annot/web/AnnotPage.html
Sat Apr 12 12:26:00 2008
@@ -19,51 +19,9 @@
This approach allows users to quickly and easily inject any component with
bean proxies. Components simply have to annotate any fields they wish injected
with @SpringBean annotation.
Interesting classes:<br/>
<ul>
- <li>ComponentInjector - an implementation of
IComponentInstantiationListener that performs the injection</li>
- <li>AnnotApplication - sets up SpringComponentInjector used to inject
annotated components</li>
- <li>BasePage - extends InjectableWebPage instead of WebPage to allow
subclasses to be injected automatically</li>
+ <li>SpringComponentInjector - an implementation of
IComponentInstantiationListener that performs the injection</li>
<li>AnnotPage - contains an annotated field whose value will be
initialized with a proxy by the injector</li>
</ul>
<table wicket:id="contacts" cellspacing="0" cellpadding="2"
class="grid"></table>
-<br/>
-Below is comparison of AnnotPage and ProxyPage. Notice how much cleaner the
dependency lookup is in the AnnotPage (in fact the lookup itself is hidden,
only an annotated field is present).
-<br/>
-<table cellspacing="0" cellpadding="2">
-<tr>
- <td style="width:50%; vertical-align:top; border-right: 1px solid
gray;">
-<pre>
-public class AnnotPage extends ContactsDisplayPage {
-
- @SpringBean private ContactDao dao;
-
- public AnnotPage() {
-
- }
-
- protected SortableDataProvider getDataProvider() {
- return new ProxyDataProvider(dao);
- }
-}
-</pre>
- </td>
- <td style="width:50%; vertical-align:top;">
-<pre>
-public class ProxyPage extends ContactsDisplayPage {
- public ProxyPage() {
-
- }
-
- private ContactDao getContactDao() {
- return ((ExampleApplication)
Application.get()).getContactDaoProxy();
- }
-
- protected SortableDataProvider getDataProvider() {
- return new ProxyDataProvider(getContactDao());
- }
-}
-</pre>
- </td>
-</tr>
-</table>
</wicket:extend>
Modified:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/common/web/ExampleApplication.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/common/web/ExampleApplication.java?rev=647493&r1=647492&r2=647493&view=diff
==============================================================================
---
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/common/web/ExampleApplication.java
(original)
+++
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/common/web/ExampleApplication.java
Sat Apr 12 12:26:00 2008
@@ -16,7 +16,7 @@
*/
package org.apache.wicket.spring.common.web;
-import org.apache.wicket.spring.SpringWebApplication;
+import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.spring.common.ContactDao;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
@@ -26,7 +26,7 @@
* @author Igor Vaynberg (ivaynberg)
*
*/
-public class ExampleApplication extends SpringWebApplication
+public class ExampleApplication extends WebApplication
{
/**
@@ -49,49 +49,7 @@
addComponentInstantiationListener(new
SpringComponentInjector(this));
}
- /**
- * Retrieves contact dao bean. This bean should not be serialized so BE
CAREFUL when using it.
- *
- * @return contact dao bean
- */
- public ContactDao getContactDao()
- {
- if (contactDao == null)
- {
- synchronized (this)
- {
- if (contactDao == null)
- {
- contactDao =
(ContactDao)internalGetApplicationContext().getBean("contactDao",
- ContactDao.class);
- }
- }
- }
- return contactDao;
- }
-
- /**
- * Returns a lazy init proxy for the dao bean. This proxy is safe to
serialize and will take up
- * very little space when serialized.
- *
- * @return a lazy init proxy for the dao bean
- */
- public ContactDao getContactDaoProxy()
- {
- if (contactDaoProxy == null)
- {
- synchronized (this)
- {
- if (contactDaoProxy == null)
- {
- contactDaoProxy =
(ContactDao)createSpringBeanProxy(ContactDao.class,
- "contactDao");
- }
- }
- }
- return contactDaoProxy;
- }
-
+ @Override
public Class getHomePage()
{
return HomePage.class;
Modified:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/common/web/HomePage.html
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/common/web/HomePage.html?rev=647493&r1=647492&r2=647493&view=diff
==============================================================================
---
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/common/web/HomePage.html
(original)
+++
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/common/web/HomePage.html
Sat Apr 12 12:26:00 2008
@@ -15,15 +15,7 @@
limitations under the License.
-->
<wicket:extend>
-This examples project demonstrates two jdk 1.4 compliant ways to integrate
wicket and spring.
-<br/><br/>
-<a href="#" wicket:id="direct-link">direct approach</a>
-<br/>
-This is the simplest of approaches. All necessary spring beans are looked up
via static lookups into the ExampleApplication class.
-<br/><br/>
-<a href="#" wicket:id="proxy-link">proxy approach</a>
-<br/>
-This approach wraps the static lookups for dependencies inside dynamic
proxies. This allows the code to be decoupled from the application and easy to
unit test.
+This examples project demonstrates how to easily integrate Wicket with Spring
framework
<br/><br/>
<a href="#" wicket:id="annot-link">jdk5 annotations approach</a><br/>
This approach allows us to annotate any component with SpringBean annotations,
and have wicket initialize those fields with spring bean proxies
Modified:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/common/web/HomePage.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/common/web/HomePage.java?rev=647493&r1=647492&r2=647493&view=diff
==============================================================================
---
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/common/web/HomePage.java
(original)
+++
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/common/web/HomePage.java
Sat Apr 12 12:26:00 2008
@@ -17,10 +17,7 @@
package org.apache.wicket.spring.common.web;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-
import org.apache.wicket.spring.annot.web.AnnotPage;
-import org.apache.wicket.spring.direct.web.DirectPage;
-import org.apache.wicket.spring.proxy.web.ProxyPage;
/**
* Home Page
@@ -32,8 +29,6 @@
{
public HomePage()
{
- add(new BookmarkablePageLink("direct-link", DirectPage.class));
- add(new BookmarkablePageLink("proxy-link", ProxyPage.class));
add(new BookmarkablePageLink("annot-link", AnnotPage.class));
}
}