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,401
  • 11
  • 62
  • 105

2 Answers2

2

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

Andy Wilkinson
  • 108,729
  • 24
  • 257
  • 242
0

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

Whimusical
  • 6,401
  • 11
  • 62
  • 105