Re: How to access the servlet context in AppModule?
Hey, You can pass Spring Services as argument by using the @Inject @Service annotations. /Serge MrclSchprs wrote: How to access the servlet context in AppModule? Tapestry's Spring integration does not work for the 'services' package. A Spring service is needed for a custom BindingFactory. My idea was to access Spring's application context and instantiate a new BindingFactory with the Spring service as constructor parameter. Any ideas? -- View this message in context: http://www.nabble.com/How-to-access-the-servlet-context-in-AppModule--tp15110070p15110348.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to access the servlet context in AppModule?
Within the AppModule you can try accessing the following services: 1) WebContextApplicationContext 2) RequestGlobals 3) @Inject @Service(beanName) SergeEby wrote: Hey, You can pass Spring Services as argument by using the @Inject @Service annotations. /Serge MrclSchprs wrote: How to access the servlet context in AppModule? Tapestry's Spring integration does not work for the 'services' package. A Spring service is needed for a custom BindingFactory. My idea was to access Spring's application context and instantiate a new BindingFactory with the Spring service as constructor parameter. Any ideas? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to access the servlet context in AppModule?
On Jan 26, 2008 6:34 PM, Fernando Padilla [EMAIL PROTECTED] wrote: Within the AppModule you can try accessing the following services: 1) WebContextApplicationContext 2) RequestGlobals 3) @Inject @Service(beanName) The third option does not work; Tapestry does only inject spring service in classes residing in 'pages' or 'components' packages. AppModule is in 'services'.
Re: How to access the servlet context in AppModule?
Ah. I think there was a misunderstanding on how AppModule/Tapestry IoC works (maybe). And we also got confused. Within AppModule/TapestryIoC, the correct annotation is @InjectService(name). But you can review the documentation to make sure that we're all on the same page: http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html And another reminder: Tapestry IoC does not enhance the classes, so the private variable enhancement does not work like it works in base/pages/components. So this will not work! public class Service { @Inject @Service(name) private Service2 service2; } Marcel Schepers wrote: On Jan 26, 2008 6:34 PM, Fernando Padilla [EMAIL PROTECTED] wrote: Within the AppModule you can try accessing the following services: 1) WebContextApplicationContext 2) RequestGlobals 3) @Inject @Service(beanName) The third option does not work; Tapestry does only inject spring service in classes residing in 'pages' or 'components' packages. AppModule is in 'services'. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to access the servlet context in AppModule?
Not sure what you are doing but the following works fine for me in my AppModule: public class AppModule { ... public static void contributeAliasOverrides ( ConfigurationAliasContribution aConfiguration, @Inject @Service(LabelService) LabelService aService) { } .. } In the example above, LabelSevice is a Spring service. /Serge MrclSchprs wrote: On Jan 26, 2008 6:34 PM, Fernando Padilla [EMAIL PROTECTED] wrote: Within the AppModule you can try accessing the following services: 1) WebContextApplicationContext 2) RequestGlobals 3) @Inject @Service(beanName) The third option does not work; Tapestry does only inject spring service in classes residing in 'pages' or 'components' packages. AppModule is in 'services'. -- View this message in context: http://www.nabble.com/How-to-access-the-servlet-context-in-AppModule--tp15110070p15111202.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to access the servlet context in AppModule?
I think I've got it working, thanks to the overlooked @InjectService. My module constructor now looks like: public AppModule(@InjectService(messageDAO) MessageDAO messageDOA) { System.out.println(messageDOA2: + messageDOA); } messageDAO is a Spring bean used in 'contributeBindingSource'. The concept of services, build... methods and contribute... methods is an area I need to dive into, it is still fuzzy. Marcel On Jan 26, 2008 7:41 PM, Fernando Padilla [EMAIL PROTECTED] wrote: Ah. I think there was a misunderstanding on how AppModule/Tapestry IoC works (maybe). And we also got confused. Within AppModule/TapestryIoC, the correct annotation is @InjectService(name). But you can review the documentation to make sure that we're all on the same page: http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html And another reminder: Tapestry IoC does not enhance the classes, so the private variable enhancement does not work like it works in base/pages/components. So this will not work! public class Service { @Inject @Service(name) private Service2 service2; } Marcel Schepers wrote: On Jan 26, 2008 6:34 PM, Fernando Padilla [EMAIL PROTECTED] wrote: Within the AppModule you can try accessing the following services: 1) WebContextApplicationContext 2) RequestGlobals 3) @Inject @Service(beanName) The third option does not work; Tapestry does only inject spring service in classes residing in 'pages' or 'components' packages. AppModule is in 'services'. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]