You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by cc...@apache.org on 2010/08/01 12:01:25 UTC

svn commit: r981192 - /tapestry/tapestry5/trunk/tapestry-spring/src/site/apt/index.apt

Author: ccordenier
Date: Sun Aug  1 10:01:25 2010
New Revision: 981192

URL: http://svn.apache.org/viewvc?rev=981192&view=rev
Log:
Document tapestry services injection into spring beans (TAP5-923)

Modified:
    tapestry/tapestry5/trunk/tapestry-spring/src/site/apt/index.apt

Modified: tapestry/tapestry5/trunk/tapestry-spring/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-spring/src/site/apt/index.apt?rev=981192&r1=981191&r2=981192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-spring/src/site/apt/index.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-spring/src/site/apt/index.apt Sun Aug  1 10:01:25 2010
@@ -73,7 +73,36 @@ Usage
 
   Searching for Spring beans is threaded into the {{{../tapestry-ioc/injection.html}MasterObjectProvider service}}. The Spring context becomes one
   more place that Tapestry searches when determining the injection for a injected field or method parameter.
+
+* Injecting Tapestry services in Spring beans
+
+  If you have configured Spring to allow annotation based injection, then you will be able to inject Tapestry services into your Spring Beans.
+
+  <<This feature is only available when Spring ApplicationContext is not configured and loaded externally. >>  
+  
+  Inside your Spring beans, you may use
+  {{{../apidocs/org/apache/tapestry5/ioc/annotations/Inject.html}Inject}} and 
+  {{{http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/beans/factory/annotation/Autowired.html}Autowired}} annotations.
+  Simply add these two annotations on top the field you want to inject in your Spring bean.
+  
++----+
+  @Inject
+  @Autowired
+  private MyService myService;
++----+
+
+  or use @Inject on top of arguments in @Autowired bean constructor methods
+  
++----+
+  private final MyService myService;
   
+  @Autowired
+  public UserDAOImpl(@Inject MyService myService)
+  {
+    this.myService = myService;
+  }
++----+
+
 * Configuring Spring with Tapestry Symbols
   
   As of version 5.2.0 it is possible to configure individual bean property values from Tapestry symbols. This is accomplished by a BeanFactoryPostProcessors