Jul 5th, 2006, 07:12 AM
Parent bean, factory and constructor-args
We have a factory bean we are writing. Currently, it takes 3 arguments in it's constructor, 2 of which are always the same, and 1 which will always vary.
I'd like to use an 'abstract bean definition', but it doesn't seem possible since this is not a property-based factory. Is there a way to do it? When I tried, splitting the arguments between two bean definitions, it said it could match the constructor. I even used 'index'.
Jul 10th, 2006, 11:49 AM
I would suggest putting the variable property to not be in the constructor but set as a property. Then use an init-method do any special post constructor processing. If your factory bean uses Spring interfaces you can implement InitializingBean and instead of an init-method use afterPropertiesSet.
Jul 11th, 2006, 03:19 AM
you won't even need an init() method, as you can validate all your params (2 for constrcuor, 1 for property) within setProperty() method.