I started with official Java Config example (https://github.com/camunda/camunda-consulting/tree/master/snippets/spring-java-based-config) and dropped ProcessApplicationBean. With SpringProcessEngineConfiguration.deploymentResources set, I am able to start processes and the engine works fine.
The problem occurs when I want a service task to call a Spring Bean by setting delegateExpression according to examples. Camunda doesn't see any beans. I tried setting SpringProcessEngineConfiguration.setBeans() explicitly with the bean I'm trying to call, but I get an error that the bean is not JavaDelegate, although it is.
What am I missing? What additional steps does SpringProcessApplication do to make everything work?
What I was missing was ProcessEngineFactoryBean. Before, I was instantiating ProcessEngine by calling SpringProcessEngineConfiguration.buildProcessEngine() directly. I should have used ProcessEngineFactoryBean, because it is aware of application context and can do the right initialization stuff.