How to add custom Rest Endpoints to Shared Engine?

For anyone following along at home, I have ended up creating a bare bones Spring Boot app using spring-boot-starter-web.
For now, I have added a RestController but will likely move to using he spring-boot-starter-graphql project once the kinks are sorted out.

In order to access the shared engine I added the following bean definitions into my spring boot application definition class:

@Bean
public ProcessEngineService getProcessEngineService() {
    return BpmPlatform.getProcessEngineService();
}

@Bean
public ProcessEngine getProcessEngine() {
	return this.getProcessEngineService().getDefaultProcessEngine();
}

Packaging for Tomcat deployment simply means to tag the spring-boot-starter-tomcat dependency as provided, changing the packaging type in maven and adding a servlet entry point:

	@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(Application.class);
}

All seems to be working pretty well.
The only issue I have right now is hot deployment seems to blow away the shared process engine, still trying to work out why, but a full restart of tomcat brings everything up correctly.

Thanks for all the suggestions and if anyone has any comments on the approach I’ve taken, I’d love to hear.
Greg