You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Cosmin Bucur <co...@gmail.com> on 2006/04/27 09:41:05 UTC
Injecting a spring bean into a Service
I have the following service :
<contribution configuration-id="tapestry.services.ApplicationServices">
<service name="reportService" object="service:ReportService" />
</contribution>
<service-point id="ReportService"
interface="org.apache.tapestry.engine.IEngineService">
<invoke-factory model="singleton">
<construct class="view.report.ReportService" />
</invoke-factory>
</service-point>
I would like to inject a spring bean into this service . I am
currently able to inject spring beans into normal tapestry pages using
: <inject property="manager" object="spring:programManager" /> in the
.jwc/.page files . What is the standard way to do this in Tap4 with
Services ? I can't seem to be able to find any examples or
documentation on this matter .
Thanks ,
Cosmin
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Injecting a spring bean into a Service
Posted by Cosmin Bucur <co...@gmail.com>.
thanks a lot
this was a bit confusing because I am used to using abstract accessors
for tapestry injections . So in fact I had it setup as you have
sugested but I had an abstract accessor . Now that someone confirmed
that my hivemodule.xml was fine , I figured i'd try with spring-style
get/set pair ...
thanks again , works fine
On 4/27/06, Christian Haselbach <ch...@tngtech.com> wrote:
> Zitat von Cosmin Bucur <co...@gmail.com>:
>
> > I have the following service :
> >
> > <contribution configuration-id="tapestry.services.ApplicationServices">
> > <service name="reportService" object="service:ReportService" />
> > </contribution>
> >
> > <service-point id="ReportService"
> > interface="org.apache.tapestry.engine.IEngineService">
> > <invoke-factory model="singleton">
> > <construct class="view.report.ReportService" />
> > </invoke-factory>
> > </service-point>
> >
> > I would like to inject a spring bean into this service . I am
> > currently able to inject spring beans into normal tapestry pages using
> > : <inject property="manager" object="spring:programManager" /> in the
> > .jwc/.page files . What is the standard way to do this in Tap4 with
> > Services ? I can't seem to be able to find any examples or
> > documentation on this matter .
>
> Without testing, just hammerd into newsclient:
>
> <service-point id="ReportService"
> interface="org.apache.tapestry.engine.IEngineService">
> <invoke-factory model="singleton">
> <construct class="view.report.ReportService">
> <set-object property="manager" value="spring:programManager"/>
> </construc>
> </invoke-factory>
> </service-point>
>
> Basically, you can set it via set-object, the spring prefix tells
> Hivemind to use the Spring Factory for injection.
>
> HTH
>
>
> Regards,
> Christian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Injecting a spring bean into a Service
Posted by Christian Haselbach <ch...@tngtech.com>.
Zitat von Cosmin Bucur <co...@gmail.com>:
> I have the following service :
>
> <contribution configuration-id="tapestry.services.ApplicationServices">
> <service name="reportService" object="service:ReportService" />
> </contribution>
>
> <service-point id="ReportService"
> interface="org.apache.tapestry.engine.IEngineService">
> <invoke-factory model="singleton">
> <construct class="view.report.ReportService" />
> </invoke-factory>
> </service-point>
>
> I would like to inject a spring bean into this service . I am
> currently able to inject spring beans into normal tapestry pages using
> : <inject property="manager" object="spring:programManager" /> in the
> .jwc/.page files . What is the standard way to do this in Tap4 with
> Services ? I can't seem to be able to find any examples or
> documentation on this matter .
Without testing, just hammerd into newsclient:
<service-point id="ReportService"
interface="org.apache.tapestry.engine.IEngineService">
<invoke-factory model="singleton">
<construct class="view.report.ReportService">
<set-object property="manager" value="spring:programManager"/>
</construc>
</invoke-factory>
</service-point>
Basically, you can set it via set-object, the spring prefix tells
Hivemind to use the Spring Factory for injection.
HTH
Regards,
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: Injecting a spring bean into a Service
Posted by Jimmi Dyson <ji...@lawton.co.uk>.
You should be able to use the set-object
(http://jakarta.apache.org/hivemind/hivemind/BuilderFactory.html#set-obj
ect):
<service-point id="ReportService"
interface="org.apache.tapestry.engine.IEngineService">
<invoke-factory model="singleton">
<construct class="view.report.ReportService" >
<set-object property="manager" value="spring:programManager"/>
</construct>
</invoke-factory>
</service-point>
-----Original Message-----
From: Cosmin Bucur [mailto:coszminb@gmail.com]
Sent: 27 April 2006 08:41
To: Tapestry users
Subject: Injecting a spring bean into a Service
I have the following service :
<contribution configuration-id="tapestry.services.ApplicationServices">
<service name="reportService" object="service:ReportService" />
</contribution>
<service-point id="ReportService"
interface="org.apache.tapestry.engine.IEngineService">
<invoke-factory model="singleton">
<construct class="view.report.ReportService" />
</invoke-factory>
</service-point>
I would like to inject a spring bean into this service . I am
currently able to inject spring beans into normal tapestry pages using
: <inject property="manager" object="spring:programManager" /> in the
.jwc/.page files . What is the standard way to do this in Tap4 with
Services ? I can't seem to be able to find any examples or
documentation on this matter .
Thanks ,
Cosmin
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org