Announcement Announcement Module
Collapse
No announcement yet.
Parent bean, factory and constructor-args Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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'.

    Thanks.
    David

  • #2
    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.

    Comment


    • #3
      you won't even need an init() method, as you can validate all your params (2 for constrcuor, 1 for property) within setProperty() method.

      Comment

      Working...
      X