Use getBeansWithAnnotation() method to get beans with annotation.
Map<String,Object> beans = applicationContext.getBeansWithAnnotation(Foo.class);
Here is similar discussion.
More Related Contents:
- Difference between and
- Injecting Mockito mocks into a Spring bean
- Spring Boot JPA – configuring auto reconnect
- Spring cannot find bean xml configuration file when it does exist
- Splitting applicationContext to multiple files
- Can SpringMVC be configured to process all requests, but exclude static content directories?
- Filter specific packages in @ComponentScan
- How to parameterize @Scheduled(fixedDelay) with Spring 3.0 expression language?
- Spring Boot: Is it possible to use external application.properties files in arbitrary directories with a fat jar?
- @Value not resolved when using @PropertySource annotation. How to configure PropertySourcesPlaceholderConfigurer?
- Where is the @Autowired annotation supposed to go – on the property or the method?
- how to capture multiple parameters using @RequestParam using spring mvc?
- spring autowiring with unique beans: Spring expected single matching bean but found 2
- Spring boot how to read properties file outside jar
- spring – hibernate 5 naming strategy configuration
- JPA / JTA / @Transactional Spring annotation
- Inject and Resource and Autowired annotations
- How to import Java-config class into XML-config so that both contexts have beans?
- Spring annotation-based DI vs xml configuration?
- Add a Servlet Filter in a Spring Boot application
- Spring HandlerMethodArgumentResolver not executing
- Auto login after successful registration
- No Spring WebApplicationInitializer types detected on classpath
- No property found for type… custom Spring Data repository
- getting exception: No bean named ‘springSecurityFilterChain’ is defined
- Escaping a dot in a Map key in Yaml in Spring Boot
- Weblogic 10.3.5 Overriding Spring Version
- Spring Boot Data JPA – Modifying update query – Refresh persistence context
- Spring boot: configure it to find the webapp folder
- Programmatic access to properties created by property-placeholder