Announcement Announcement Module
No announcement yet.
How to get all @Controller (or all @Component) classes Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get all @Controller (or all @Component) classes

    The subject pretty much says it all:

    How to get all @Controller (or all @Component) classes in Spring 2.5?

    I need to get a List<String> with the full class names of all the Spring Beans
    that have the @Controller (and/or @Component) annotation.

    AFAIK that information is in the class BeanDefintion, but I the only way
    I see to get a list of BeanDefinitions (and then extract the name of all the classes) is the BeanDefinitionRegistry.getBeanDefinition method, and I can not find a way to reach that method from my WebApplicationContext.

    WebApplicationContext has a method getBeanDefinitionNames, but it does not have a method getBeanDefinition so I can not obtain the BeanDefinitions for my beans....

    Is there a way to do this?

  • #2
    Annotation-based beans filetring with Spring