Announcement Announcement Module
Collapse
No announcement yet.
How to get the Bean Definition? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get the Bean Definition?

    I like to get the Bean Definition of a certain Bean. My code is:

    Code:
    ApplicationContext ac = new ClassPathXmlApplicationContext(beans.xml");
    StaticApplicationContext sac = new StaticApplicationContext(ac);
    BeanDefinition bd = sac.getBeanDefinition("Bean_Definition_Name");
    I get an "org.springframework.beans.factory.NoSuchBeanDefin itionException" Exception and invoking
    Code:
    sac.getBeanDefinitionCount()
    returns 0 although I have 4 Bean Definitions in the "beans.xml" file. Invoking
    Code:
    ac.getBeanDefinitionCount()
    returns 4...

    Does anyone have any idea what the problem is or another solution how to get the Bean Definition of a certain bean?

    Thank you,
    Raphael

  • #2
    Maybe the method getMergedBeanDefinition does the job.

    Regards,
    Andreas

    Comment

    Working...
    X