文章标签 ‘nutz’
2017三月23

NutzWk: 微信AccessToken没有持久化造成超出调用限制的问题解决

1、wx_config 实体类添加三个字段,对应的表结构也要手动修改:


    @Column
    @Comment("access_token")
    @ColDefine(type = ColType.VARCHAR, width = 255)
    private String access_token;

    @Column
    @Comment("access_token_expires")
    @ColDefine(type = ColType.INT)
    private Integer access_token_expires;

    @Column
    @Comment("access_token_lastat")
    @ColDefine(type = ColType.VARCHAR, width = 50)
    private String access_token_lastat;

    get  set ...方法生成出来

2、nutzwx版本升级为1.r.61-SNAPSHOT

        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzwx</artifactId>
            <version>1.r.61-SNAPSHOT</version>
        </dependency>


3、nutz版本升级为1.r.60

        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutz</artifactId>
            <version>1.r.60</version>
        </dependency>

4、WxConfigService 类getWxApi2替换为如下代码(主要是DaoAccessTokenStore从数据库取access_token)

    public WxApi2 getWxApi2(String wxid) {
        Wx_config appInfo = this.fetch(Cnd.where("id", "=", wxid));
        DaoAccessTokenStore myDaoAccessTokenStore = new DaoAccessTokenStore(dao());
        Map<String, Object> params = new HashMap<>();
        params.put("id", appInfo.getId());
        myDaoAccessTokenStore.setTableAccessToken("access_token");
        myDaoAccessTokenStore.setTableAccessTokenExpires("access_token_expires");
        myDaoAccessTokenStore.setTableAccessTokenLastat("access_token_lastat");
        myDaoAccessTokenStore.setFetch("select access_token,access_token_expires,access_token_lastat from wx_config where id=@id");
        myDaoAccessTokenStore.setUpdate("update wx_config set access_token=@access_token, access_token_expires=@access_token_expires, access_token_lastat=@access_token_lastat where id=@id");
        myDaoAccessTokenStore.setParams(params);
        WxApi2Impl wxApi2 = new WxApi2Impl();
        wxApi2.setAppid(appInfo.getAppid());
        wxApi2.setAppsecret(appInfo.getAppsecret());
        wxApi2.setEncodingAesKey(appInfo.getEncodingAESKey());
        wxApi2.setToken(appInfo.getToken());
        wxApi2.setAccessTokenStore(myDaoAccessTokenStore);
        return wxApi2;
    }
2016十二月8

Nutz:组合查询、子查询示例代码

        Cnd cnd = Cnd.NEW();
        if (!Strings.isBlank(src)) {
            cnd.and("srcFrom", "=", src);
        }
        if (!Strings.isBlank(name)) {
            String[] n = StringUtils.split(name, " ");
            SqlExpressionGroup group = new SqlExpressionGroup();
            for (String s : n) {
                SqlExpression sqlExpression = Cnd.exp("srcName", "like", "%" + s + "%");
                group.or(sqlExpression);
            }
            cnd.and(group);
        }
        cnd.and(Cnd.exps("productSku", "=", "").or("productSku", "is", null));
2016十月20

Nutz:fetchLinks 三级关联表的应用

        Shop_goods_type obj = shopGoodsTypeService.fetch(id);
        shopGoodsTypeService.fetchLinks(obj, null, Cnd.orderBy().asc("location"));
        for (Shop_goods_type_props o : obj.getPropsList()) {
            shopGoodsTypeService.dao().fetchLinks(o, null, Cnd.orderBy().asc("location"));
        }
2015六月11

Nutz:集成 CXF Webservice [通过cxf-servlet.xml配置文件]

pom.xml

	<!--CXF START-->
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-api</artifactId>
            <version>2.7.15</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>2.7.15</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-bindings-soap</artifactId>
            <version>2.7.15</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>2.7.15</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-ws-security</artifactId>
            <version>2.7.15</version>
        </dependency>
        <dependency>
           <groupId>org.springframework</groupId>
           <artifactId>spring-web</artifactId>
           <version>4.1.5.RELEASE</version>
        </dependency>
        <!--CXF END-->

web.xml

    <servlet>
        <servlet-name>CXFServlet</servlet-name>
        <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>CXFServlet</servlet-name>
        <url-pattern>/webservice/*</url-pattern>
    </servlet-mapping>

cxf-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jaxws="http://cxf.apache.org/jaxws"
       xmlns:soap="http://cxf.apache.org/bindings/soap"
       xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">

    <!-- IP地址输入拦截器 -->
    <bean id="ipAddressInInterceptor"
          class="com.auto.webservice.servlet.IpAddressInInterceptor" />

    <jaxws:server id="workflow" serviceClass="com.auto.webservice.server.WorkflowService" address="/workflow">
        <jaxws:serviceBean>
            <bean class="com.auto.webservice.server.WorkflowServiceImpl" />
        </jaxws:serviceBean>
    </jaxws:server>
</beans>

接口类
WorkflowService.java

package com.auto.webservice.server;

import org.nutz.json.Json;

import javax.jws.WebService;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by wizzer on 15-4-13.
 */
@WebService(targetNamespace = "http://server.webservice.auto.com/", name = "workflowServicePortType")
public interface WorkflowService {

    @WebResult(name = "return")
    @Action(input = "urn:start", output = "urn:startResponse")
    @RequestWrapper(localName = "start")
    @WebMethod(action = "urn:start")
    @ResponseWrapper(localName = "startResponse")
    String start(@WebParam(name = "flowKey") String flowKey, @WebParam(name = "userId") String userId);//启动流程
}

实现类

WorkflowServiceImpl.java
package com.auto.webservice.server;

import org.activiti.engine.*;
import org.activiti.engine.form.FormProperty;
import org.activiti.engine.form.StartFormData;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.activiti.engine.task.TaskQuery;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.json.JsonFormat;
import org.nutz.lang.Strings;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.Mvcs;

import javax.jws.WebService;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by wizzer on 15-4-13.
 */
@IocBean(name = "workflowService")
@WebService
public class WorkflowServiceImpl implements WorkflowService {
    private final Log log = Logs.get();
    FormService formService=Mvcs.ctx().getDefaultIoc().get(FormService.class);
    IdentityService identityService=Mvcs.ctx().getDefaultIoc().get(IdentityService.class);
    RuntimeService runtimeService=Mvcs.ctx().getDefaultIoc().get(RuntimeService.class);
    TaskService taskService=Mvcs.ctx().getDefaultIoc().get(TaskService.class);
    RepositoryService repositoryService=Mvcs.ctx().getDefaultIoc().get(RepositoryService.class);

    /**
     * 启动一个流程
     *
     * @param flowKey 流程模型key
     * @param userId  用户ID
     * @return
     */
    public String start(String flowKey, String userId) {
        Map<String, Object> map = new HashMap<String, Object>();
        try {
            if (!Strings.isEmpty(userId)) {
                identityService.setAuthenticatedUserId(userId);
            }
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(flowKey);
            map.put("errcode", 0);
            map.put("errmsg", "");
            map.put("processInstanceId", processInstance.getId());
        } catch (Exception e) {
            log.error("WebServcice启动流程出错", e);
            map.put("errcode", 1);
            map.put("errmsg", e.getMessage());
        } finally {
            identityService.setAuthenticatedUserId(null);
        }
        return Json.toJson(map, JsonFormat.compact());
    }


}
 
/**
 * IP地址拦截器
 *
 * @author Sunshine
 */

public class IpAddressInInterceptor extends AbstractPhaseInterceptor {
    private final Log log = Logs.get();

    public IpAddressInInterceptor() {
        super(Phase.RECEIVE);
    }

    public void handleMessage(Message message) throws Fault {
        HttpServletRequest request = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
        //获取所有的白名单访问主机
        UserInfoServiceImpl userInfoService = Mvcs.ctx().getDefaultIoc().get(UserInfoServiceImpl.class);
        List hostList = userInfoService.queryHostListByType("w");
        // 取客户端IP地址
        String ipAddress = request.getRemoteAddr();
        // 如果允许访问的集合非空,继续处理,否则认为全部IP地址均合法
        if (!hostList.isEmpty()) {
            boolean contains = false;
            for (ListInfo hostInfo : hostList) {
                log.debug("hostInfo:" + hostInfo.getIpaddress() + "|ipAddress:" + ipAddress);
                if (hostInfo.getIpaddress().equals(ipAddress)) {
                    contains = true;
                    break;
                }
            }
            if (!contains) {
                throw new Fault(new IllegalAccessException("IP address " + ipAddress + " is not allowed"));
            }
        }
    }

}
2015五月18

Activiti:获取节点走向

 @At
    public String test5(@Param("taskId") String taskId) {
        Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
        if (task == null)
            return "null";
        ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(task.getProcessDefinitionId());
        List<ActivityImpl> activitiList = def.getActivities();
        System.out.println("getTaskDefinitionKey:::" + task.getTaskDefinitionKey());
        NutMap map = new NutMap();
        int type = 0;
        getTaskActivitys(task.getTaskDefinitionKey(), activitiList, type, map);
        return Json.toJson(map);
    }

    public static List<PvmActivity> getTaskActivitys(String activityId, List<ActivityImpl> activityList, int type, NutMap map) {
        List<PvmActivity> activitiyIds = new ArrayList<>();
        for (ActivityImpl activityImpl : activityList) {
            String id = activityImpl.getId();

            if (activityId.equals(id)) {
                List<PvmTransition> outgoingTransitions = activityImpl.getOutgoingTransitions();//获取某节点所有线路
                List<NutMap> list = new ArrayList<>();
                for (PvmTransition tr : outgoingTransitions) {
                    NutMap map1 = new NutMap();
                    PvmActivity ac = tr.getDestination();//获取线路的终点节点
                    if (ac.getProperty("type").equals("userTask")) {
                        map.setv("type", type++);
                        map1.setv("id", ac.getId());
                        map1.setv("name", ac.getProperty("name"));
                        String conditionText=Strings.sNull(tr.getProperty("conditionText"));
                        if(!Strings.isEmpty(conditionText)){
                            map1.setv("conditionText",conditionText );
                        }
                        list.add(map1);
                    } else if (ac.getProperty("type").equals("exclusiveGateway")) {
                        getTaskActivitys(ac.getId(), activityList, type, map);
                    } else {
                        map.setv("type", type++);
                        break;
                    }
                }
                if (list.size() > 0)
                    map.addv("list", list);
                break;
            }
        }
        return activitiyIds;
    }
2015五月12

Nutz:集成CXF webservice

通过配置文件实现(这个支持CXF spring注解)点这里

pom.xml

	<!--CXF START-->
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-api</artifactId>
            <version>2.7.15</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>2.7.15</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-bindings-soap</artifactId>
            <version>2.7.15</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>2.7.15</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-ws-security</artifactId>
            <version>2.7.15</version>
        </dependency>
        <!--CXF END-->

web.xml

    <servlet>
        <servlet-name>CXFServlet</servlet-name>
        <servlet-class>com.auto.webservice.servlet.CXFServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>CXFServlet</servlet-name>
        <url-pattern>/webservice/*</url-pattern>
    </servlet-mapping>
CXFServlet.java:
package com.auto.webservice.servlet;

import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.frontend.ServerFactoryBean;
import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
import org.nutz.ioc.Ioc;
import org.nutz.lang.Strings;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.Mvcs;

import javax.jws.WebService;
import javax.servlet.ServletConfig;
import javax.xml.namespace.QName;

/**
 * Created by wizzer on 15-4-10.
 */
@SuppressWarnings("serial")
public class CXFServlet extends CXFNonSpringServlet {
    private final Log log = Logs.get();

    @Override
    protected void loadBus(ServletConfig sc) {
        super.loadBus(sc);

        //全局配置
        Bus bus = getBus();
        //添加白名单过滤器
        bus.getInInterceptors().add(new IpAddressInInterceptor());
        //使用全局配置
        BusFactory.setDefaultBus(bus);
        Ioc ioc = Mvcs.ctx().getDefaultIoc();
        for (String name : ioc.getNames()) {
            try {
                Object obj = ioc.get(null, name);
                if (!obj.getClass().getPackage().getName().equals("com.auto.webservice.server")) {
                    continue;
                }
                if (obj.getClass().getAnnotation(WebService.class) == null)
                    continue;
                Class face = Class.forName(obj.getClass().getPackage().getName() + "." + Strings.upperFirst(name));
                ServerFactoryBean serverFactoryBean = new ServerFactoryBean();
                // 设置服务接口类
                serverFactoryBean.setServiceClass(face);
                // 服务请求路径
                serverFactoryBean.setAddress("/" + name.substring(0, name.indexOf("Service")));
                // 设置服务实现类
                serverFactoryBean.setServiceBean(obj);
                serverFactoryBean.setBindingId("http://schemas.xmlsoap.org/wsdl/soap12/");
                serverFactoryBean.create();
            } catch (Throwable e) {
            }
        }


    }
}

接口类

WorkflowService.java
package com.auto.webservice.server;

import org.nutz.json.Json;

import javax.jws.WebService;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by wizzer on 15-4-13.
 */
@WebService
public interface WorkflowService {
    String start(String flowKey, String userId);//启动流程

}

 

实现类

WorkflowServiceImpl.java

 

package com.auto.webservice.server;

import org.activiti.engine.*;
import org.activiti.engine.form.FormProperty;
import org.activiti.engine.form.StartFormData;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.activiti.engine.task.TaskQuery;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.json.JsonFormat;
import org.nutz.lang.Strings;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.Mvcs;

import javax.jws.WebService;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by wizzer on 15-4-13.
 */
@IocBean(name = "workflowService")
@WebService
public class WorkflowServiceImpl implements WorkflowService {
    private final Log log = Logs.get();
    @Inject
    Dao dao;
    @Inject
    FormService formService;
    @Inject
    IdentityService identityService;
    @Inject
    RepositoryService repositoryService;
    @Inject
    RuntimeService runtimeService;
    @Inject
    TaskService taskService;

    /**
     * 启动一个流程
     *
     * @param flowKey 流程模型key
     * @param userId  用户ID
     * @return
     */
    public String start(String flowKey, String userId) {
        Map<String, Object> map = new HashMap<String, Object>();
        try {
            if (!Strings.isEmpty(userId)) {
                identityService.setAuthenticatedUserId(userId);
            }
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(flowKey);
            map.put("errcode", 0);
            map.put("errmsg", "");
            map.put("processInstanceId", processInstance.getId());
        } catch (Exception e) {
            log.error("WebServcice启动流程出错", e);
            map.put("errcode", 1);
            map.put("errmsg", e.getMessage());
        } finally {
            identityService.setAuthenticatedUserId(null);
        }
        return Json.toJson(map, JsonFormat.compact());
    }


}

 

2015五月7

Nutz:随笔01

在nutz filter作用域内才能Mvcs.getIoc()

其他情况:

Mvcs.ctx().getDefaultIoc().get(xxx.class)
2015四月27

Nutz 集成Activiti5.17.0 [03]扩展用户、组使用自己的数据表

首先值得一提的是,taskService.createTaskQuery().taskCandidateOrAssigned(userId) 方法有bug,不会调用重写的工厂类,请使用taskService.createTaskQuery().taskCandidateUser(userId)方法。

CustomGroupEntityManager

/**
 * 分组工厂类
 * Created by wizzer on 15-4-27.
 */
@IocBean
public class CustomGroupEntityManager extends GroupEntityManager {
    Dao dao= Mvcs.getIoc().get(Dao.class);
    private final Log log = Logs.get();

    @Override
    public List<Group> findGroupsByUser(String userId) {
        Sql sql = Sqls.create("SELECT a.* FROM sys_role a,sys_user_role b WHERE a.id=b.roleid AND b.userid=@c");
        sql.params().set("c", userId);
        sql.setCallback(Sqls.callback.maps());
        dao.execute(sql);
        List<Map> list=sql.getList(Map.class);
        List<Group> groupList=new ArrayList<Group>();
        for (Map m:list){
            GroupEntity group=new GroupEntity();
            group.setId(Strings.sNull(m.get("id")));
            group.setName(Strings.sNull(m.get("name")));
            group.setType("assignment");
            group.setRevision(1);
            groupList.add(group);
        }
        return groupList;
    }
}

 

CustomGroupEntityManagerFactory

/**
 * 分组接口类
 * Created by wizzer on 15-4-27.
 */
@IocBean
public class CustomGroupEntityManagerFactory implements SessionFactory {
    private GroupEntityManager groupEntityManager;
    public void setGroupEntityManager(GroupEntityManager groupEntityManager) {
        this.groupEntityManager = groupEntityManager;
    }
    @Override
    public Class<?> getSessionType() {
        return GroupIdentityManager.class;
    }
    @Override
    public Session openSession() {
        return groupEntityManager;
    }
}

 

CustomUserEntityManager

/**
 * 用户工厂类
 * Created by wizzer on 15-4-24.
 */
@IocBean
public class CustomUserEntityManager extends UserEntityManager {
    Dao dao= Mvcs.getIoc().get(Dao.class);
    private final Log log = Logs.get();

    @Override
    public User findUserById(String userId) {

        log.info("findUserById:::::::::::::::::::::::::::::::"+userId);
        UserEntity userEntity = new UserEntity();
        Sys_user sysUser = dao.fetch(Sys_user.class, Cnd.where("uid", "=", userId));
        userEntity.setId(userId);
        userEntity.setFirstName(sysUser.getRealname());
        userEntity.setEmail(sysUser.getEmail());
        userEntity.setRevision(1);
        return userEntity;
    }

    @Override
    public List<Group> findGroupsByUser(String userId) {
        // TODO Auto-generated method stub
        log.info("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
        Sql sql = Sqls.create("SELECT a.* FROM sys_role a,sys_user_role b WHERE a.id=b.roleid AND b.userid=@c");
        sql.params().set("c", userId);
        sql.setCallback(Sqls.callback.maps());
        dao.execute(sql);
        List<Map> list=sql.getList(Map.class);
        List<Group> groupList=new ArrayList<Group>();
        for (Map m:list){
            GroupEntity group=new GroupEntity();
            group.setId(Strings.sNull(m.get("id")));
            group.setName(Strings.sNull(m.get("name")));
            group.setType("assignment");
            group.setRevision(1);
            groupList.add(group);
        }
        return groupList;
    }


}

 

CustomUserEntityManagerFactory

/**
 * 用户接口类
 * Created by wizzer on 15-4-24.
 */
@IocBean
public class CustomUserEntityManagerFactory implements SessionFactory {
    private UserEntityManager userEntityManager;
    public void setUserEntityManager(UserEntityManager userEntityManager) {
        this.userEntityManager = userEntityManager;
    }
    @Override
    public Class<?> getSessionType() {
        return UserIdentityManager.class;
    }
    @Override
    public Session openSession() {
        return userEntityManager;
    }
}

Nutz 集成Activiti5.17.0 [01]初始化activiti

在初始化activiti时追加代码:

        List<SessionFactory> list=new ArrayList<SessionFactory>();
        CustomGroupEntityManagerFactory customGroupManagerFactory=new CustomGroupEntityManagerFactory();
        customGroupManagerFactory.setGroupEntityManager(new CustomGroupEntityManager());
        CustomUserEntityManagerFactory customUserEntityManagerFactory=new CustomUserEntityManagerFactory();
        customUserEntityManagerFactory.setUserEntityManager(new CustomUserEntityManager());
        list.add(customGroupManagerFactory);
        list.add(customUserEntityManagerFactory);
        processEngineConfiguration.setCustomSessionFactories(list);
2015四月27

Nutz 集成Activiti5.17.0 [02]集成流程设计器及汉化

下载 activiti-modeler 源码,里面的方法用nutz重写,然后修改editor-app里面页面和js里对应的路径。

5.17.0汉化文件下载:http://pan.baidu.com/s/1qWlzHDE

细节不多述了,自己动手吧,哇哈哈……

2015四月27

Nutz 集成Activiti5.17.0 [01]初始化activiti

@SetupBy(value=StartSetup.class)
public class MainModule {
}

private void activitiInit(NutConfig config) {
        log.info("Activiti Init Start...");
        ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
                .createStandaloneProcessEngineConfiguration();

        processEngineConfiguration.setDataSource(config.getIoc().get(DataSource.class));
        processEngineConfiguration.setDatabaseSchemaUpdate("false");
        processEngineConfiguration.setJobExecutorActivate(false);
        processEngineConfiguration.setActivityFontName("宋体");
        processEngineConfiguration.setLabelFontName("宋体");
        processEngineConfiguration.setXmlEncoding("utf-8");
        ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
        ((Ioc2) config.getIoc()).getIocContext().save("app", "processEngine", new ObjectProxy(processEngine));
        ((Ioc2) config.getIoc()).getIocContext().save("app", "repositoryService", new ObjectProxy(processEngine.getProcessEngineConfiguration().getRepositoryService()));
        ((Ioc2) config.getIoc()).getIocContext().save("app", "runtimeService", new ObjectProxy(processEngine.getProcessEngineConfiguration().getRuntimeService()));
        ((Ioc2) config.getIoc()).getIocContext().save("app", "taskService", new ObjectProxy(processEngine.getProcessEngineConfiguration().getTaskService()));
        ((Ioc2) config.getIoc()).getIocContext().save("app", "formService", new ObjectProxy(processEngine.getProcessEngineConfiguration().getFormService()));
        ((Ioc2) config.getIoc()).getIocContext().save("app", "historyService", new ObjectProxy(processEngine.getProcessEngineConfiguration().getHistoryService()));
        ((Ioc2) config.getIoc()).getIocContext().save("app", "managementService", new ObjectProxy(processEngine.getProcessEngineConfiguration().getManagementService()));
        ((Ioc2) config.getIoc()).getIocContext().save("app", "identityService", new ObjectProxy(processEngine.getProcessEngineConfiguration().getIdentityService()));
        log.info("Activiti Init End.");

    }