Shared ProcessEngine is being closed when used with Spring


#1

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


#2

Hi Camunda folks,

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

Regards
Matthias


#3

Hi Matthias,

Which versions do you use - camunda & starter?

Best regards,
Yana


#4

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


#5

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