我正在尝试使用一个简单的Spring示例来使用Activiti 5.5,并遇到一些麻烦.我正在使用在%activiti_home%/ apps/apache-tomcat-6.0.32/webapps/activiti-rest下配置了activiti的流程引擎.
我修改了spring配置文件,以便它执行我的自定义spring配置文件的include:
<import resource="classpath*:applicationContext*.xml"/>
Run Code Online (Sandbox Code Playgroud)
我将applicationContext.xml文件部署到activiti-rest/WEB-INF/classes文件夹.Activiti启动正常,我在我的bean构造函数中看到System.out.println,所以我知道正在读取我的spring配置并且正在构造bean.我为实现JavaDelegate的类创建了一个spring bean,并将bean注入其中,并且它总是为null.
这是我的Spring配置:
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<bean id="myBean" class="org.bpmn.examples.MyBean"/>
<bean id="taskBean" class="org.bpmn.examples.GetBeanTest">
<property name="myBean" ref="myBean"/>
</bean>
</beans>
Run Code Online (Sandbox Code Playgroud)
这是我的豆子:
package org.bpmn.examples;
import java.io.Serializable;
public class MyBean implements Serializable {
public MyBean() {
super();
System.out.println("<========================== myBean ===========================>");
System.out.println("<========================== myBean ===========================>");
System.out.println("<========================== myBean ===========================>");
}
/**
*
*/
private static final long serialVersionUID = -2867207654072787909L;
Long id;
String description;
public Long getId() {
return id; …Run Code Online (Sandbox Code Playgroud)