My application uses a custom servlet filter added to the web.xml of the Cuba Web Client block. This needs access to the Cuba managed service beans such as DataManager, so to perform the injection I have the following code in the filter init() method:
However when switching deployment to single WAR mode and adding the same filter definition to single-war-web.xml, the autowireBean() call above fails to inject any managed bean references. I also tried using AppBeans.get() to obtain managed bean services by class or name, and this always returns null.
I inspected com.haulmont.cuba.web.sys.singleapp.SingleAppWebServletListener, which is referenced in single-war-web.xml, and realised that it performs the job of registering the Cuba servlets and filters in single WAR mode programmatically instead of declaratively in web.xml. I tried this approach with my own ServletListener but again the managed beans were inaccessible from the context/classloader of the ServletListener.
So, the question is how can I obtain Cuba managed bean references from my servlet filter in single WAR deployment mode?