1

I am using Spring Boot autoconfiguration to load a bean in the context in case there is at least one of 3 beans present.

I need something like:

@Bean
@ConditionalOnANYClass({ CreateHandler.class, UpdateHandler.class, DeleteHandler.class})

Any smart solution or out-of-the-box annotation for the logical OR?

Whimusical
  • 6,111
  • 10
  • 57
  • 96

2 Answers2

2

You can use AnyNestedCondition with one nested condition per class that you want to match.

Andy Wilkinson
  • 97,688
  • 22
  • 237
  • 223
0

Interesting report from the very Spring Gitub Issue track: https://github.com/spring-projects/spring-boot/issues/5279

Whimusical
  • 6,111
  • 10
  • 57
  • 96