Is there a way to check if a bean is defined in spring context? Try this: if(appContext.containsBeanDefinition(w.getName())) ; // Get the bean