diff --git a/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-actuator/pom.xml b/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-actuator/pom.xml
index 9ee8487e0c6e982564e8a6b1e99f223ddd710b55..fdf0dbbe7e7efec233e69dcba855ee19ae183ff4 100644
--- a/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-actuator/pom.xml
+++ b/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-actuator/pom.xml
@@ -17,10 +17,25 @@
spring-boot-starter-basic
${project.version}
+
+
+ org.activiti
+ activiti-image-generator
+
+
+ org.activiti
+ activiti-bpmn-model
+
org.springframework.boot
spring-boot-starter-actuator
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+ true
+
\ No newline at end of file
diff --git a/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-actuator/src/main/java/org/activiti/spring/boot/actuate/endpoint/EndpointAutoConfiguration.java b/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-actuator/src/main/java/org/activiti/spring/boot/actuate/endpoint/EndpointAutoConfiguration.java
index 94a3ca13bd417499aaa3dad933128bfe625a1914..55b54ff77515d50af2416331801674aaed189843 100644
--- a/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-actuator/src/main/java/org/activiti/spring/boot/actuate/endpoint/EndpointAutoConfiguration.java
+++ b/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-actuator/src/main/java/org/activiti/spring/boot/actuate/endpoint/EndpointAutoConfiguration.java
@@ -1,6 +1,7 @@
package org.activiti.spring.boot.actuate.endpoint;
import org.activiti.engine.ProcessEngine;
+import org.activiti.engine.RepositoryService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -15,8 +16,13 @@ import org.springframework.context.annotation.Configuration;
public class EndpointAutoConfiguration {
@Bean
- public ProcessEngineEndpoint processEngineMetric( ProcessEngine engine){
- return new ProcessEngineEndpoint( engine) ;
+ public ProcessEngineEndpoint processEngineEndpoint(ProcessEngine engine) {
+ return new ProcessEngineEndpoint(engine);
}
+ @Bean
+ public ProcessEngineMvcEndpoint processEngineMvcEndpoint(
+ ProcessEngineEndpoint engineEndpoint, RepositoryService repositoryService) {
+ return new ProcessEngineMvcEndpoint(engineEndpoint, repositoryService);
+ }
}
diff --git a/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-actuator/src/main/java/org/activiti/spring/boot/actuate/endpoint/ProcessEngineEndpoint.java b/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-actuator/src/main/java/org/activiti/spring/boot/actuate/endpoint/ProcessEngineEndpoint.java
index c830a45f333066e2df5325ffa2f1bc1b5f365641..5c7f6ba915ef457c80bfeda860a6abdfcda5b3c1 100644
--- a/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-actuator/src/main/java/org/activiti/spring/boot/actuate/endpoint/ProcessEngineEndpoint.java
+++ b/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-actuator/src/main/java/org/activiti/spring/boot/actuate/endpoint/ProcessEngineEndpoint.java
@@ -7,6 +7,12 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.List;
+/**
+ * Registers a Boot Actuator endpoint that provides information on the
+ * running process instance and renders BPMN diagrams of the deployed processes.
+ *
+ * @author Josh Long
+ */
@ConfigurationProperties(prefix = "endpoints.activiti")
public class ProcessEngineEndpoint extends AbstractEndpoint> {
@@ -26,13 +32,3 @@ public class ProcessEngineEndpoint extends AbstractEndpoint
.list();
}
}
-
- /* ProcessDefinition processDefinition = repositoryService
- .createProcessDefinitionQuery().processDefinitionKey(pd).singleResult();
- ProcessDiagramGenerator processDiagramGenerator = new DefaultProcessDiagramGenerator();
- InputStream is = processDiagramGenerator
- .generatePngDiagram(repositoryService
- .getBpmnModel(processDefinition.getId()));
-
- return new InputStreamResource(is);
- */
\ No newline at end of file
diff --git a/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-actuator/src/main/java/org/activiti/spring/boot/actuate/endpoint/ProcessEngineMvcEndpoint.java b/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-actuator/src/main/java/org/activiti/spring/boot/actuate/endpoint/ProcessEngineMvcEndpoint.java
new file mode 100644
index 0000000000000000000000000000000000000000..e6ad070862c000963626f582903602a946afa1c3
--- /dev/null
+++ b/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-actuator/src/main/java/org/activiti/spring/boot/actuate/endpoint/ProcessEngineMvcEndpoint.java
@@ -0,0 +1,47 @@
+package org.activiti.spring.boot.actuate.endpoint;
+
+import org.activiti.bpmn.model.BpmnModel;
+import org.activiti.engine.RepositoryService;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.image.ProcessDiagramGenerator;
+import org.activiti.image.impl.DefaultProcessDiagramGenerator;
+import org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter;
+import org.springframework.core.io.InputStreamResource;
+import org.springframework.core.io.Resource;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.io.InputStream;
+
+/**
+ * Renders a valid running BPMN process definition as a BPMN diagram.
+ *
+ * This is duplicative of the functionality in the full REST API implementation.
+ *
+ * @author Joram Barrez
+ * @author Josh Long
+ */
+public class ProcessEngineMvcEndpoint extends EndpointMvcAdapter {
+
+ private final RepositoryService repositoryService;
+
+ public ProcessEngineMvcEndpoint(ProcessEngineEndpoint processEngineEndpoint, RepositoryService repositoryService) {
+ super(processEngineEndpoint);
+ this.repositoryService = repositoryService;
+ }
+
+ @RequestMapping(value = "/processes/{processDefinitionKey:.*}", method = RequestMethod.GET, produces = MediaType.IMAGE_JPEG_VALUE)
+ @ResponseBody
+ public Resource processDefinitionDiagram(@PathVariable String processDefinitionKey) {
+ ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+ .processDefinitionKey(processDefinitionKey).singleResult();
+ ProcessDiagramGenerator processDiagramGenerator = new DefaultProcessDiagramGenerator();
+ BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
+ InputStream is = processDiagramGenerator.generateJpgDiagram(bpmnModel);
+ return new InputStreamResource(is);
+ }
+
+}
diff --git a/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-basic/src/test/java/org/activiti/spring/boot/TestProcessEngineAutoConfiguration.java b/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-basic/src/test/java/org/activiti/spring/boot/TestProcessEngineAutoConfiguration.java
index c07cdc2636d9e7ed65e6fe23290eaa8443ae3ed6..95296d282ba8d9dbda8c4228e3d3ac553f98c846 100644
--- a/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-basic/src/test/java/org/activiti/spring/boot/TestProcessEngineAutoConfiguration.java
+++ b/modules/activiti-spring-boot/spring-boot-starters/spring-boot-starter-basic/src/test/java/org/activiti/spring/boot/TestProcessEngineAutoConfiguration.java
@@ -33,7 +33,7 @@ public class TestProcessEngineAutoConfiguration {
public static class SimpleDataSourceConfiguration {
@Bean
- public TaskExecutor taskExecutor() {
+ TaskExecutor taskExecutor() {
return new SimpleAsyncTaskExecutor();
}