首先要将自己实现的TaskListener类交由Spring管理。我统一将这些类采用 @Component 或者@Service注解,然后配置自动扫描。
<context:component-scan base-package="edu.xxx.web.activiti.listener" use-default-filters="false"><!-- base-package 如果多个,用“,”分隔 -->
<context:include-filter type="annotation" expression="org.springframework.stereotype.Component" />
</context:component-scan>
在填写监听器的地方,不要直接写类了,改用表达式。
Spring自动扫描生成的实例,在上下文件中的id是小写开头类名