bike part reward : setting bean ID property automatically

Brent Putman putmanb at georgetown.edu
Thu Feb 6 20:41:58 EST 2014


On 2/6/14 8:33 PM, Tom Zeller wrote:
> I'll offer bike parts from my bike part bin if someone can figure out
> how we can set an IdentifiableComponent's ID via Spring without
> setting the 'id' property in addition to the 'id' attribute.

I think that's done pretty easily automagically with a BeanPostProcessor
that does something like:

Object postProcessBeforeInitialization(Object bean, String beanName)
throws BeansException {
  if (bean instanceof IdentifiableComponent) {
    ((IdentifiableComponent)bean).setID(beanName);
  }
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://shibboleth.net/pipermail/dev/attachments/20140206/45e27c7f/attachment.html 


More information about the dev mailing list