Not easily. Problem is that Castor does not use Spring internally. As
such, it's Castor that is in control of instantiating your custom
FieldHandler as required.
Let me look at this in more detail, and maybe come up with an idea. All
I can think right now is that you overload the constructor of your
custom FieldHandler and do a manual 'injection' by looking up your
CustomManger instance through a bean lookup.
Not ideal, but at least something to consider in the meantime.
Werner
Felipe Toledo wrote:
In my CustomerFieldHandler:
public class CustomerFieldHandler extends GeneralizedFieldHandler {
private ICustomerManager customerManager;
public Object convertUponSet(Object value) {
Customer customer = null;
if (value != null) {
customer = customerManager.getByID( (Long) value);
customer.setDeviceAddress((String)value);
}
return customer;
}
The problem is that the CustomerManager instance is controlled with Spring.
How do I connect this FieldHandler to Spring in order to have a manager's
instance injected?
Werner Guttmann wrote:
Can you show us some code fragments that illustrate what you are trying
to do ?
Werner
Felipe Toledo wrote:
Hil all,
Im trying to use Castor with Spring.
The problem:
- In my xml is mapped the Customer ID;
- This Customer is just instantiated thru the CustomerManager, which
instance is controlled with spring.
- I have created the CustomerFieldHandler to create/retrieve the new
instance.
Question: How to inject a new CustomerManager instance in the
FieldHandler?
---------------------------------------------------------------------
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