I have 3 implementations of an interface, and in order to instantiate one of them I need to check a parameter from the database. I was planning to do it with the factory pattern, but since I'm using JSF 2 dependecy injection in the rest of my application I was wondering if there's a way to do that, is it possible to do the dependency injection dinamically? can I indicate somehow a method or something to pick up the correct implementation at each moment? For the backend I'm using spring core, so a way to do that with the spring context would work to.
I'm using Annotations for everything (@Autowired
for Spring, @ManagedProperty
for JSF).
EDIT: The project will be deployed on a Tomcat server.