Shared ProcessEngine is being closed when used with Spring

Hi,

I’m using a shared process engine (defined in Tomcat’s server.xml) in a Spring application.
My @Configuration is straight forward:

@Bean public ProcessEngine processEngine(ProcessEngineService processEngineService) { return processEngineService.getDefaultProcessEngine(); }

@Bean public RepositoryService repositoryService(ProcessEngine processEngine) { return processEngine.getRepositoryService(); }

Now, the problem is that ProcessEngine.close() is being called when the Spring ApplicationContext is being closed!
That means my Process-Application is shutting down the globally shared process engine!

I’ve found a way to avoid that behavoir by setting @Bean(destroyMethod = StringUtils.EMPTY) for processEngine(), but I wanted to make sure if there is another approach or if my configuration is wrong.

This topic may be related:

There, a difference in behavoir between Spring 3 and 4 was mentioned.
And in deed, Spring’s DisposableBeanAdapter calls close() for a bean that does not implement DisposableBean since 3.2:

(see https://jira.spring.io/browse/SPR-10034)

Regards
Matthias

Hi Camunda folks,

I hoped to get some feedback here.
Are my configuration and assumptions correct?
Or am I missing something?

Regards
Matthias

Hi Matthias,

Which versions do you use - camunda & starter?

Best regards,
Yana

My bad, you are not using spring boot started but spring, right?

Hi Yana,

you’re right, I’m using plain Spring with my own @ProcessApplication.
Camunda is version 7.8.x, Spring is 4.3.x.

Regards
Matthias