Announcement Announcement Module
No announcement yet.
Getting the id of a singleton from a bean factory Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting the id of a singleton from a bean factory

    Is there a way to ask a bean factory for the original ID of a singleton which it returned?

    The usage here is for multiple, dynamic long lived quartz tasks. I want to be able to programmatically schedule quartz tasks, and pass in the typed object to a job details creator method, and have that method put the objects spring name into the JobDetailMap automatically.

    Right now the hack-around is to limit objects that I'm passing in to those implementing an extended BeanNameAware interface with a getBeanName. But that seems a little lame.



  • #2
    There's no way to find out the id that I know of now. You could put in a feature request in Jira, although this is the first time I've ever seen somebody ask for something like this. Any such method would have to return potentially multiple names, and of course it would only work for singletons.

    I presume you are not specifically asking for the beans one by one, so the client (using the beans) never kniows the name?