-
Dec 14th, 2006, 08:12 AM
#1
Integration with Tapestry 4.1
Hello,
I have problem with integration Spring 2.0 with Tapestry 4.1. I have follewed this guide http://static.springframework.org/sp...ry-40-style-di and some others. Iam using tapestry-spring.jar 0.1.2. When I start Tomcat, Spring loads correctly defined bean (I can see in log how it works), but when I need to get Injected objects in Tapestry page, it returns only null. Do you have any idea what is wrong?
Many thanks,
Jirka
my web.xml
<web-app>
<display-name>Transformations management</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/config/springconfig.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
</listener>
<servlet>
<servlet-name>etlmon</servlet-name>
<servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>etlmon</servlet-name>
<url-pattern>/app</url-pattern>
</servlet-mapping>
</web-app>
hivemodule.xml
<module id="cz.profinit.watchdog" version="1.0.0">
<service-point id="SpringApplicationInitializer" interface="org.apache.tapestry.services.Applicatio nInitializer" visibility="private">
<invoke-factory>
<construct class="com.javaforge.tapestry.spring.SpringApplica tionInitializer">
<set-object property="beanFactoryHolder" value="service:hivemind.lib.DefaultSpringBeanFacto ryHolder" />
</construct>
</invoke-factory>
</service-point>
<!-- Hook the Spring setup into the overall application initialization. -->
<contribution configuration-id="tapestry.init.ApplicationInitializers">
<command id="spring-context" object="service:SpringApplicationInitializer" />
</contribution>
<contribution configuration-id="tapestry.state.ApplicationObjects">
<state-object name="userData" scope="session">
<create-instance class="cz.profinit.watchdog.monitor.tapestry.page. UserData"/>
</state-object>
</contribution>
</module>
part of Tapestry java class
public abstract class ETLMONBasePage extends BasePage implements PageValidateListener {
@InjectObject("spring:monitorbean")
public abstract Monitor getMonitorBean();
Monitor monitor;
public ETLMONBasePage() {
super();
System.out.println("is null "+(monitor==null));
}
It always print is null true.
-
Dec 14th, 2006, 08:51 AM
#2
Not sure but in Spring dependencies are injected AFTER object constuction. So while still in the constructor the dependencies would indeed display null.
-
Dec 14th, 2006, 08:55 AM
#3
Many thanks, it works now:-).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules