You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by gshavit <gs...@medio.com> on 2009/09/29 02:03:06 UTC

Re: injecting t5 services into spring beans

I banged my head against this for a while, and finally I figured it out: the
injection won't happen unless the property is "autowired", in the Spring
sense. Now, this should happen if you set "autowire='byType'" on the <bean>
tag, but for some reason that hasn't worked for me. 

What did work is putting
@org.springframework.beans.factory.annotation.Autowired on the property
itself. When I did that, the relevant code in the TapestryFactoryBean that
resolves dependencies was invoked, and my services were created (as proxies,
of course) and injected properly.

I would love to know, BTW, why "autowire='byType'" didn't work. Anybody?

-- Gidon.


Andrea Chiumenti wrote:
> 
> I'm trying to integrate T5 with jax-ws-commons
> (https://jax-ws-commons.dev.java.net/spring/).
> 
> my web.xml is
> 
> <web-app>
>     <display-name>server Tapestry 5 Application</display-name>
>     <context-param>
>         <!-- The only significant configuration for Tapestry 5, this
> informs Tapestry
> of where to look for pages, components and mixins. -->
>         <param-name>tapestry.app-package</param-name>
>         <param-value>it.wingstech.gam3.server</param-value>
>     </context-param>
> 
>     <context-param>
>         <param-name>contextConfigLocation</param-name>
>         <param-value>/WEB-INF/applicationContext.xml</param-value>
>     </context-param>
> 
>     <!--context-param>
>         <param-name>tapestry.use-external-spring-context</param-name>
>         <param-value>true</param-value>
>     </context-param-->
> 
>     <filter>
>         <filter-name>app</filter-name>
>        
> <filter-class>org.apache.tapestry5.spring.TapestrySpringFilter</filter-class>
>     </filter>
>     <filter-mapping>
>         <filter-name>app</filter-name>
>         <url-pattern>/*</url-pattern>
>     </filter-mapping>
> 
>   <!-- these are for JAX-WS -->
>     <servlet>
>         <servlet-name>echoService</servlet-name>
>        
> <servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>echoService</servlet-name>
>         <url-pattern>/ws/echoWS</url-pattern>
>     </servlet-mapping>
> </web-app>
> 
> then into
> AppModule#bind
> I call
> binder.bind(EchoService.class);
> 
> springApplication context is:
> ....
> <wss:binding url="/ws/echoWS">
>     <wss:service><!-- nested bean is of course fine -->
>       <ws:service bean="#echoServiceWrapper">
>         <ws:handlers>
>           <ref bean="wsHandler" />
>         </ws:handlers>
>       </ws:service>
>     </wss:service>
>   </wss:binding>
> 
>   <bean id="echoServiceWrapper"
> class="it.wingstech.gam3.server.soap.EchoServiceWrapper">
> 
>   </bean>
> 
>   <bean id="wsHandler" class="it.wingstech.gam3.server.soap.WsHandler" />
> ....
> 
> finally EchoServiceWrapper.java is
> 
> package it.wingstech.gam3.server.soap;
> 
> import it.wingstech.gam3.server.services.EchoService;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.soap.SOAPBinding.Style;
> import org.apache.tapestry5.ioc.annotations.Inject;
> 
> /**
>  * Canonical stock-quote web service.
>  * @author Kohsuke Kawaguchi
>  */
> @WebService(serviceName = "echoWS")
> //@SOAPBinding(style=Style.DOCUMENT, use=Use.LITERAL,parameterStyle =
> ParameterStyle.WRAPPED)
> @SOAPBinding(style = Style.DOCUMENT, parameterStyle =
> SOAPBinding.ParameterStyle.BARE)
> public class EchoServiceWrapper
> {
> 
>     @Inject
>     private EchoService echoService;
> 
>     public String echo(String value)
>     {
>         return echoService.echo(value);
>     }
> }
> 
> 
> -------------------------------------------------------------------------------------------------
> 
> debugging I see that echoService is null
> 
> so how can I do ? (in tapestry 5.1.0.4)
> 
> kiuma
> 
> 
> 
> 
> On Fri, May 15, 2009 at 3:49 PM, Andrea Chiumenti <ki...@gmail.com>
> wrote:
>> T 5.1.0.4
>>
>> On Fri, May 15, 2009 at 3:45 PM, Geoffrey Wiseman
>> <ge...@gmail.com> wrote:
>>> On Fri, May 15, 2009 at 9:37 AM, Andrea Chiumenti <ki...@gmail.com>
>>> wrote:
>>>
>>>> Hello, is it possible to inject T5 bound services into Spring beans
>>>>
>>>
>>> I believe this is possible in 5.1.X but not 5.0.X -- what version are
>>> you
>>> using?
>>>
>>>  - Geoffrey
>>> --
>>> Geoffrey Wiseman
>>> http://www.geoffreywiseman.ca/
>>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/injecting-t5-services-into-spring-beans-tp23560068p25654867.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org