How can I find all beans with the custom annotation @Foo?

Use getBeansWithAnnotation() method to get beans with annotation.

Map<String,Object> beans = applicationContext.getBeansWithAnnotation(Foo.class);

Here is similar discussion.

Leave a Comment