SpringMVC项目集成Activiti Modeler(Activiti5.20版本)

原创
2016/05/20 16:27
阅读数 1.3W

Activiti版本是5.20,Modeler模块跟5.16.4之前变化很大,相关的API已经大变样。

假设已经有SpringMVC的项目,只需要把以下文件复制到自己的项目中,包名可以改,但是在自动搜索类的时候请指定包路径。

配置文件如下:

<bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper" />

<context:component-scan base-package="edu.xxx.web.rest" use-default-filters="false">
        <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    </context:component-scan>

Modeler相关的Rest入口

以上三个文件,我放到项目中的: edu.xxx.web.rest 这个位置。

Modeler相关的页面文件

app-cfg.js文件也需要修改下,指定contextRoot为 /项目/service

以上截图中使用到的Activiti源码项目中的文件,可以到这里下载:

https://codeload.github.com/Activiti/Activiti/zip/master

还要检查Rest的入口路径是否与自己的项目路径一致。默认是这样:

@RequestMapping(value="/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")

我改成这样:

@RequestMapping(value="/service/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")

/项目路径/process-editor/modeler.html?modelId=xxx就可以访问到在线的模型编辑器了。请格外留意红色部分的路径,如果是在现有项目里升级Modeler,请修改相应的入口路径。

展开阅读全文
打赏
3
46 收藏
分享
加载中
车开源博主

引用来自“mohanwen”的评论

<!-- 单例json对象 -->
<bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper"/>
是的,写漏了这个。
2016/06/12 10:38
回复
举报
<!-- 单例json对象 -->
<bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper"/>
2016/06/07 22:44
回复
举报

引用来自“admin_wt”的评论

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'modelSaveRestResource': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.fasterxml.jackson.databind.ObjectMapper com.edp.admin.rest.ModelSaveRestResource.objectMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.fasterxml.jackson.databind.ObjectMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
麻烦问下,这是什么问题?
2016/06/07 22:44
回复
举报

引用来自“admin_wt”的评论

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'modelSaveRestResource': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.fasterxml.jackson.databind.ObjectMapper com.edp.admin.rest.ModelSaveRestResource.objectMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.fasterxml.jackson.databind.ObjectMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
麻烦问下,这是什么问题?
2016/06/07 22:43
回复
举报

引用来自“车开源”的评论

引用来自“admin_wt”的评论

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'modelSaveRestResource': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.fasterxml.jackson.databind.ObjectMapper com.edp.admin.rest.ModelSaveRestResource.objectMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.fasterxml.jackson.databind.ObjectMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
麻烦问下,这是什么问题?

字面意思说注入失败呢,是不是缺包什么?
我也是这个问题,解决了吗
2016/06/07 22:19
回复
举报

引用来自“陈杰敏”的评论

你好,rest路径在哪里修改呢,我在整合的时候报路径找不到
我也是集成activiti5.20出问题,加QQ交流下 414215875
2016/06/05 14:23
回复
举报

引用来自“admin_wt”的评论

有呀!我已经引了
我也是集成activiti5.20出问题了,加QQ交流下 414215875
2016/06/05 14:23
回复
举报
你好,rest路径在哪里修改呢,我在整合的时候报路径找不到
2016/06/04 18:38
回复
举报
有呀!我已经引了
2016/06/02 16:29
回复
举报
车开源博主

引用来自“admin_wt”的评论

<artifactId>jackson-dataformat-smile</artifactId>
     <version>${fasterxml.jackson.version}</version>
    </dependency>
    <dependency>
     <groupId>com.fasterxml.jackson.dataformat</groupId>
     <artifactId>jackson-dataformat-xml</artifactId>
     <version>${fasterxml.jackson.version}</version>
    </dependency>
    <dependency>
     <groupId>com.fasterxml.jackson.dataformat</groupId>
     <artifactId>jackson-dataformat-yaml</artifactId>
     <version>${fasterxml.jackson.version}</version>
    </dependency>
    <dependency>
     <groupId>com.fasterxml.jackson.dataformat</groupId>
     <artifactId>jackson-dataformat-csv</artifactId>
     <version>${fasterxml.jackson.version}</version>
    </dependency>
    <dependency>
     <groupId>com.fasterxml.jackson.core</groupId>
     <artifactId>jackson-databind</artifactId>
     <version>${fasterxml.jackson.version}</version>
    </dependency>
看配置貌似没问题什么呢。但看日志,com.fasterxml.jackson.databind.ObjectMapper这个类所在包是不是没有?
2016/06/02 15:55
回复
举报
更多评论
打赏
16 评论
46 收藏
3
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部