|
Hi,
I'm a bit of a mule newbie so this might be a pretty basic (aka stupid) question, but how do you bind a component to a pre-initialized spring bean? I'm able to create a component by specifying a class like this: <component class="MyComponent"> But I need to use use IoC on MyComponent to set some properties so the component needs to be wired to a spring bean. I've read the docs and can't find how to do this. I've experimented with a few things that haven't worked, but now I'm pretty much stuck. Initializing the spring bean is working fine, it's the wiring of that to the component that is causing problems. - I tried a few variations of this: <spring:bean id="myComponent" class="MyComponent"> <spring:property name="foo" value="bar"/> </spring:bean> <component ref="myComponent"/> - And this: <component> <spring:bean class="MyComponent"> <spring:property name="foo" value="bar"/> </spring:bean> </component> This doc _seems_ like it should describe what I'm trying to do, but it doesn't really: http://www.mulesource.org/display/MULE2USER/Using+Spring+as+a+Component+Factory thanks, Bill --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
This page hasn't yet been updated (check the yellow note at the top). If your ide didn't give you auto-completion options, try the <spring:bean ref="myComponent"/>
HTH, Andrew |
|
In reply to this post by billgraham
Hi,
Sorry about the docs, this will be updated soon. Solution is: <spring:bean id="myComponent" class="MyComponent"> <spring:property name="foo" value="bar"/> </spring:bean> <component> <spring-bean name="myComponent"/> </component> Dan > On Jul 24, 2008, at 2:51 PM, Bill Graham wrote: > Hi, > > I'm a bit of a mule newbie so this might be a pretty basic (aka > stupid) question, but how do you bind a component to a pre- > initialized spring bean? I'm able to create a component by > specifying a class like this: > > <component class="MyComponent"> > > But I need to use use IoC on MyComponent to set some properties so > the component needs to be wired to a spring bean. I've read the docs > and can't find how to do this. I've experimented with a few things > that haven't worked, but now I'm pretty much stuck. Initializing the > spring bean is working fine, it's the wiring of that to the > component that is causing problems. > > - I tried a few variations of this: > > <spring:bean id="myComponent" class="MyComponent"> > <spring:property name="foo" value="bar"/> > </spring:bean> > <component ref="myComponent"/> > > - And this: > > <component> > <spring:bean class="MyComponent"> > <spring:property name="foo" value="bar"/> > </spring:bean> > </component> > > > This doc _seems_ like it should describe what I'm trying to do, but > it doesn't really: > http://www.mulesource.org/display/MULE2USER/Using+Spring+as+a+Component+Factory > > thanks, > Bill > > > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by billgraham
Thanks for the quick reply! I tried what you described, but got the following error: <component> <spring:bean ref="myComponent"/> </component> [2008-07-24 11:13:01.509] org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unnamed bean definition specifies neither 'class' nor 'parent' nor 'factory-bean' - can't generate bean name ----- Original Message ---- From: Andrew Perepelytsya <[hidden email]> To: [hidden email] Sent: Thursday, July 24, 2008 10:56:35 AM Subject: Re: [mule-user] Configuring a spring bean as a component This page hasn't yet been updated (check the yellow note at the top). If your ide didn't give you auto-completion options, try the <spring:bean ref="myComponent"/>
HTH, Andrew |
|
In reply to this post by billgraham
Thanks Dan for the quick reply. I tried that and got the following error:
[2008-07-24 11:16:58.678] [07-24 11:16:58] ERROR AbstractConfigurationBuilder [main]: Configuration with "org.mule.config.builders.WebappMuleXmlConfigurationBuilder" failed. [2008-07-24 11:16:58.678] org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: The element 'spring-bean' does not have an associated Bean Definition Parser. Is the module or transport associated with http://www.mulesource.org/schema/mule/core/2.0 present on the classpath? <spring:bean ref="myComponent"/> was also suggested, but that doesn't work either, as I replied in a fork of this thread. Any other suggestions? ----- Original Message ---- From: Daniel Feist <[hidden email]> To: [hidden email] Sent: Thursday, July 24, 2008 10:58:49 AM Subject: Re: [mule-user] Configuring a spring bean as a component Hi, Sorry about the docs, this will be updated soon. Solution is: <spring:bean id="myComponent" class="MyComponent"> <spring:property name="foo" value="bar"/> </spring:bean> <component> <spring-bean name="myComponent"/> </component> Dan > On Jul 24, 2008, at 2:51 PM, Bill Graham wrote: > Hi, > > I'm a bit of a mule newbie so this might be a pretty basic (aka > stupid) question, but how do you bind a component to a pre- > initialized spring bean? I'm able to create a component by > specifying a class like this: > > <component class="MyComponent"> > > But I need to use use IoC on MyComponent to set some properties so > the component needs to be wired to a spring bean. I've read the docs > and can't find how to do this. I've experimented with a few things > that haven't worked, but now I'm pretty much stuck. Initializing the > spring bean is working fine, it's the wiring of that to the > component that is causing problems. > > - I tried a few variations of this: > > <spring:bean id="myComponent" class="MyComponent"> > <spring:property name="foo" value="bar"/> > </spring:bean> > <component ref="myComponent"/> > > - And this: > > <component> > <spring:bean class="MyComponent"> > <spring:property name="foo" value="bar"/> > </spring:bean> > </component> > > > This doc _seems_ like it should describe what I'm trying to do, but > it doesn't really: > http://www.mulesource.org/display/MULE2USER/Using+Spring+as+a+Component+Factory > > thanks, > Bill > > > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Sorry I should have check first, what I remember wasn't quite right.
<component> <spring-object bean="myComponent"/> </component> If you use xml editor then you should get suggestions and auto-compete etc. and this would be much much easier. Dan On Jul 24, 2008, at 3:20 PM, Bill Graham wrote:
|
|
In reply to this post by billgraham
Thanks, that did the trick. I'm now up and running in my IDE too, so things should be easier now. ----- Original Message ---- From: Daniel Feist <[hidden email]> To: [hidden email] Sent: Thursday, July 24, 2008 11:30:49 AM Subject: Re: [mule-user] Configuring a spring bean as a component Sorry I should have check first, what I remember wasn't quite right. <component> <spring-object bean="myComponent"/> </component> If you use xml editor then you should get suggestions and auto-compete etc. and this would be much much easier. Dan On Jul 24, 2008, at 3:20 PM, Bill Graham wrote:
|
| Powered by Nabble | Edit this page |
