【activiti】spring boot中使用activiti
2017-03-04 本文已影响594人
JerryL_
1.导入依赖
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-rest</artifactId>
<version>${activiti.version}</version>
</dependency>
2.扫描activiti rest controller所在的包
图片.png扫描org.activiti.rest就行了,会扫描下面的所有子包。
@SpringBootApplication
@ComponentScan("org.activiti.rest")
public class SpringBootWithActivitiApplication {
···
3.配置两个bean
//rest service
@Bean
public RestResponseFactory restResponseFactory(){
return new RestResponseFactory();
}
@Bean
public ContentTypeResolver contentTypeResolver(){
return new DefaultContentTypeResolver();
}
4.使用rest api
如:
1.获取所有deployments:
GET
/repository/deployments
response:
{
"data": [
{
"id": "10",
"name": "activiti-examples.bar",
"deploymentTime": "2010-10-13T14:54:26.750+02:00",
"category": "examples",
"url": "http://localhost:8081/service/repository/deployments/10",
"tenantId": null
}
],
"total": 1,
"start": 0,
"sort": "id",
"order": "asc",
"size": 1
}
2.根据id查询deployment
GET
/repository/deployments/{deploymentId}
response:
{
"id": "10",
"name": "activiti-examples.bar",
"deploymentTime": "2010-10-13T14:54:26.750+02:00",
"category": "examples",
"url": "http://localhost:8081/service/repository/deployments/10",
"tenantId" : null
}
3.根据id删除deployment
DELETE
/repository/deployments/{deploymentId}
response:
成功时,状态码为204。
4.更多的activiti rest api
https://www.activiti.org/userguide/#_rest_api
activiti version 5.22.0
spring boot version 1.5.1