Skip to content

Commit

Permalink
fix: regression - spring cloud stream causes annotated beans to be bl…
Browse files Browse the repository at this point in the history
…ank on first pass - (resolves redisgh-111)
  • Loading branch information
bsbodden committed Nov 1, 2022
1 parent 82d6bf2 commit 646d7de
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,13 @@ public static String asString(Object value, MappingRedisOMConverter mappingConve
@SuppressWarnings({ "unchecked", "rawtypes" })
public static Set<BeanDefinition> getBeanDefinitionsFor(ApplicationContext ac, Class... classes) {
Map<String, Object> annotatedBeans = ac.getBeansWithAnnotation(SpringBootApplication.class);
Class<?> app = annotatedBeans.values().toArray()[0].getClass();
Class<?> app = annotatedBeans.isEmpty() ? null : annotatedBeans.values().toArray()[0].getClass();
Set<BeanDefinition> beanDefs = new HashSet<>();

if (app == null) {
return beanDefs;
}

ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
for (Class cls : classes) {
provider.addIncludeFilter(new AnnotationTypeFilter(cls));
Expand Down

0 comments on commit 646d7de

Please sign in to comment.