aspose file tools*
The moose likes Other Application Frameworks and the fly likes spring injection without bean reference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "spring injection without bean reference" Watch "spring injection without bean reference" New topic
Author

spring injection without bean reference

praveen Shangunathan
Ranch Hand

Joined: Sep 06, 2005
Posts: 65
I am trying to inject a class type using a setter. I am able to do it by defining what i want to inject as a bean.
How can I do this without having to define what I am injecting as a bean.

When I tried <property name="name" value="com.foo.bar.className"> I get a type mismatch error that string cannot be cast to className.

Please advice.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

Well if you really don't want to create a <bean> for that other object, you could implement FactoryBean, and in the getObject() create an instance of the object you want to inject and call the setter.

Or you can define that other object as a bean.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
praveen Shangunathan
Ranch Hand

Joined: Sep 06, 2005
Posts: 65
Thanks Mark.
 
 
subject: spring injection without bean reference