From what I understood from question, there is only one bean of type roleManager
but the usage of roleManager
is based on application flow.
In this scenario, I would recommend you to inject roleManager
to ruleEngineAction
as you would do with any other bean but use the bean only when it is necessary.
It is a bad practice to needless dependency to spring in normal classes like adding reference to applicationContext
for fetching the bean dynamically at runtime.