Ok please ignore that it was just me being stupid. I got it working now. Thanks.

--- On Tue, 10/5/10, Jeshurun Daniel <sjeshu...@yahoo.ca> wrote:

From: Jeshurun Daniel <sjeshu...@yahoo.ca>
Subject: Injecting Tapestry Services into Spring beans
To: "Tapestry users" <users@tapestry.apache.org>
Received: Tuesday, October 5, 2010, 1:25 PM

Would someone please enlighten me on how to achieve this? Tapestry 5.1 release 
notes state that "Tapestry Services can now be injected into Spring Beans, when 
using the Tapestry/Spring integration library."
Integration of spring beans into tapestry pages works fine, but injecting 
Tapestry services into spring beans only gives me a null object. 

I read a mailing list thread where one user had succeeded in this by using 
Spring's <context:component-scan> and then @autowired on the beans, but when I 
tried this I got errors "No service implements the interface 
org.apache.tapestry5.services.Session" or any other service I'm trying to inject
I have not enabled legacy mode in my web.xml. Here is my web.xml

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
    version="2.4">
 <display-name>My App</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>ca.my.app</param-value>
    </context-param>
    <context-param>
 
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/daoContext.xml /WEB-INF/applicationContext.xml 
/WEB-INF/securityContext.xml</param-value>
    </context-param>
 
    <filter>
     <filter-name>HibernateFilter</filter-name>
        
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
        <init-param>
            <param-name>sessionFactoryBeanName</param-name>
            <param-value>assessmentSessionFactory</param-value>
        </init-param>
    </filter>
    <filter-mapping>
     <filter-name>HibernateFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter>
        <filter-name>app</filter-name>
        <!--
            Special filter that adds in a T5 IoC module derived from the Spring
            WebApplicationContext.
        -->
        
<filter-class>org.apache.tapestry5.spring.TapestrySpringFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>app</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>REQUEST</dispatcher>
 </filter-mapping>

</web-app>

I would really appreciate if someone could give me a heads up on where my 
problem might be. 
Thanks.






Reply via email to