Hi, I'm facing the same issue, ie. I want to inject a Spring Bean an there is more than one Spring Bean that implement the declared interface. In my Spring Bean in such case, I use the Spring Bean ID to specify which one I want.
I understand it is not possible yet with Tapestry 5, but it is maybe possible to easily implement the feature. I would appreciate any suggestion how to start searching in the source code. Best regards. Nicolas. Le jeudi 06 mai 2010 à 13:37 -0400, Alex Kotchnev a écrit : > Captain Cid, > the Tapestry spring integration cannot handle injecting a bean when there > is more than one bean of the given type defined in Spring (as the error > message says). Your option there is to inject the factory bean into your T5 > page, and then use that to retrieve the instance you need. T5 doesn't > support injecting spring beans by name. > > Regarding the service IDs : I don't think services in spring are defined > as "Service IDs" in Tapestry , hence the error message. I think somewhere > between 5.0 and 5.1 spring beans stopped being true "T5 services" (which has > a special meaning of its own). You can still inject spring beans though. > > Regards, > > Alex Kotchnev > > On Thu, May 6, 2010 at 11:24 AM, Captain Cid > <captain_...@indiatimes.com>wrote: > > > > > Can anyone please look into this > > > > Thanks > > > > > > Captain Cid wrote: > > > > > > I even tried > > > > > > @Inject > > > @Service("process") > > > private Process process; > > > > > > Caused by: java.lang.RuntimeException: Service id 'Process' is not > > defined > > > by any module. > > > > > > I am only using this configuration file to load beans...so i guess there > > > should not be a confusion or second possibility > > > > > > > > > Michael Prescott-4 wrote: > > >> > > >> Re: the first error, it looks like Spring is trying to inject your class > > >> 'by > > >> type', but isn't sure which of two Process beans to use. I only see one > > >> from the snippet you've attached, is it possible that there's another > > >> one? > > >> > > >> As far as the second error goes, the ids are probably case sensitive - > > >> 'Process' vs. 'process'. > > >> > > >> On Wed, May 5, 2010 at 2:52 PM, Captain Cid > > >> <captain_...@indiatimes.com>wrote: > > >> > > >>> > > >>> I have a spring configuration file config.xml: > > >>> > > >>> <?xml version="1.0" encoding="UTF-8"?> > > >>> <beans xmlns="http://www.springframework.org/schema/beans" > > >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > >>> xsi:schemaLocation="http://www.springframework.org/schema/beans > > >>> > > >>> http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> > > >>> > > >>> <bean id="Configuration" class="A"> > > >>> <constructor-arg value="config.xml" /> > > >>> </bean> > > >>> > > >>> <bean id="process" factory-bean="Configuration" > > >>> factory-method="build" /> > > >>> <bean id="rep" factory-bean="process" factory-method="getRep" /> > > >>> <bean id="exec" factory-bean="process" factory-method="getExec" > > >>> /> > > >>> > > >>> </beans> > > >>> > > >>> And web.xml > > >>> ------------- > > >>> > > >>> <?xml version="1.0" encoding="UTF-8"?> > > >>> <web-app> > > >>> <display-name>Example</display-name> > > >>> > > >>> <context-param> > > >>> <param-name>tapestry.app-package</param-name> > > >>> <param-value>com.ui</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> > > >>> > > >>> <context-param> > > >>> <description>Init Spring > > ApplicationContext</description> > > >>> <param-name>contextConfigLocation</param-name> > > >>> <param-value>/WEB-INF/config.xml</param-value> > > >>> <listener> > > >>> > > >>> > > >>> > > <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> > > >>> </listener> > > >>> </context-param> > > >>> </web-app> > > >>> > > >>> > > >>> --------- > > >>> in my class > > >>> i am using > > >>> > > >>> @Inject > > >>> private Process process; > > >>> > > >>> I get exception > > >>> > > >>> Caused by: java.lang.IllegalArgumentException: Spring context contains > > 2 > > >>> beans a > > >>> ssignable to type org.Process: Configuration, process. > > >>> at > > >>> org.apache.tapestry5.internal.spring.SpringModuleDef$4$1.provide(Spri > > >>> ngModuleDef.java:258) > > >>> at > > >>> org.apache.tapestry5.internal.spring.SpringModuleDef$4$2$1.invoke(Spr > > >>> ingModuleDef.java:274) > > >>> at > > >>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(Operati > > >>> onTrackerImpl.java:68) > > >>> > > >>> And if I use > > >>> ----------- > > >>> @Inject > > >>> @Service("Process") > > >>> private Process process; > > >>> > > >>> Caused by: java.lang.RuntimeException: Service id 'Process' is not > > >>> defined > > >>> by any module. Defined services: ActionRenderResponseGenerator, > > >>> AjaxComp.. > > >>> > > >>> -- > > >>> View this message in context: > > >>> > > http://old.nabble.com/Problem-with-spring-integration-tp28464988p28464988.html > > >>> Sent from the Tapestry - User mailing list archive at Nabble.com. > > >>> > > >>> > > >>> --------------------------------------------------------------------- > > >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > >>> For additional commands, e-mail: users-h...@tapestry.apache.org > > >>> > > >>> > > >> > > >> > > > > > > > > > > -- > > View this message in context: > > http://old.nabble.com/Problem-with-spring-integration-tp28464988p28475340.html > > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org