Short version: I want to be able to manually instantiate and control the lifecycle of statefull beans in Wildfly.
Long version:
I have a system that instantiates several different models of a system. These beans are all instantiated as singleton beans so they can keep their state and take inputs as a group. They are always looked up as a group with
@Inject
@Any
Instance<BusinessInterface> businessBeans;
which allows me to pas them all input as a group and collect their data as a group. It also means that I can deploy new singleton beans/models and they get pulled into the workflow dynamically. I don't have any need to ever look up any specific models/beans.
Now, for the problem that anyone with experience sees coming from a mile away: a new requirement means that I need to be able to deploy multiple copies of each model. But they're singletons. Is there a way to make this work? I feel like there must be a way for me to manually instantiate beans that won't die until I kill them, but I can't seem to find it.