I know this is an old post but I’ve used the method from the following article (or a variant of it) many times:
https://medium.com/@pradumnkr98/dynamic-bean-injection-in-spring-how-to-select-beans-based-on-enum-values-ea290fdd4442