Tapestry Annotations are an *alternative* to the xml in the .page/.jwc,
so you can do everything either with annotations or with xml -
in this case:
<inject object="spring:InvoiceDao" property="invoiceDAO"/>
and in your page class :
public abstract DAO getInvoiceDAO();
then use the abstract method normally,
Cheers,
Ron
ציטוט Andrew B:
I have tapestry-spring.jar, and have read the wiki
page. The last thing the wiki says is how to inject a
Spring bean into the page, not the page class.
Is using the annotation
@InjectObject("spring:InvoiceDao")
the only way to do it? The reason I ask is that I am
trying to avoid having to use JDK1.5 if possible, for
compatiblity with deployment environments. But, if
that's the only way to do the dependency injection,
then that's what I'll have to do.
Thanks
--- Oliver Lietz <[EMAIL PROTECTED]> wrote:
Am Sonntag, 30. Oktober 2005 17:59 schrieb Andrew B:
Hi,
I have a Tapestry 4/Spring/Hibernate application,
and
I would like to inject a dependency into a page
class,
that Tapestry then calls to render a page.
The page class is Home, and the dependency is
invoiceDao. In my applicationContext I have:
<beans>
<bean id="Home"
class="com.mypackage.Home">
<property name="invoiceDao">
<ref bean="invoiceDao"/>
</property>
</bean>
<bean id="invoiceDao"
class="com.mypackage.dao.InvoiceDao">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate"/>
</property>
</bean>
......
</beans>
[...]
Hello Andrew,
remove the Home bean from your applicationContext
and use
@InjectObject("spring:InvoiceDao")
public abstract InvoiceDao getInvoiceDao();
instead. You need an additional jar:
tapestry-spring.jar from
http://sourceforge.net/projects/diaphragma, look at
http://wiki.apache.org/jakarta-tapestry/Tapestry4Spring
for more information.
Oliver
---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]