新版本5.17,5.18與之前版本有點區別,寫說說集成。以前版本的集成已經有不少例子了。新版本的集成能夠先下載http://repo1.maven.org/maven2/org/activiti activiti-webapp-explorer2 裏面的源碼,複製到項目便可。因爲新版本使用了servlet3.0java配置servlet。若是使用不支持3.0的容器,能夠使用手動在web.xml中添加springmvc和spring的配置。java
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:application-context.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- Spring Security Filter Chain. This filter-name must not be changed. The <http> namespace creates a Spring bean with this name and the DelegatingFilterProxy will use this filter-name to delegate to the bean. --> <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>RestFulServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>RestFulServlet</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping> </web-app>
這裏把下載的java文件依舊加入工程,在spring中配置掃描 <context:component-scan base-package="org.activiti.rest" />便可。 這裏爲了簡便直接使用了spring的父容器加載spring mvc的controller,你們在集成的時候能夠把spring mvc的分開掃描。web
順便說一下新版本的接口變化,rest接口,從之前使用restlet框架改爲了springmvc,因此在集成modeler的時候使用到接口,從配置restlet改爲spring mvc就能夠。 不過3.0中的初始化在servlet中加入了異步的屬性,如下版本沒辦法,只能暫時先不配進去,後面你們有什麼好方法能夠借鑑,還有新版本的接口驗證使用spring Security 的basic驗證,你們能夠考慮着加入。 其實總的來講從集成上,主要是把spring的配置從xml改爲了java配置,並使用了servlet3.0的特性其餘基本仍是同樣。因此主要從這幾個地方作修改便可。spring