Thanks for Activiti Team make this amazing framework, and we can custom it by Spring Injection. But when I want to make the part of My IndentityService, I found that the mybatis`s mappings.xml couldn`t injected. Because I want to use my own User, Membership, Group tables.
Spring-activiti.xml:
<blockcode>
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration"
p:dataSource-ref="activitiDataSource"
p:transactionManager-ref="activitiTransactionManager"
p:databaseSchemaUpdate="true"
p:jobExecutorActivate="false"
p:deploymentResources="/WEB-INF/config/activiti/*.bpmn20.xml">
<property name="customSessionFactories">
<list>
<bean class="org.gdut.ptg.base.bpmn.activiti.core.PtgGroupEntityManager"/>
<bean class="org.gdut.ptg.base.bpmn.activiti.core.PtgIndentityInfoEntityManager"/>
<bean class="org.gdut.ptg.base.bpmn.activiti.core.PtgMembershipEntityManager"/>
<bean class="org.gdut.ptg.base.bpmn.activiti.core.PtgUserEntityManager"/>
</list>
</property>
</bean>
</blockcode>
But the ProcessEngineConfigurationImpl.class
<blockcode>
public static final String DEFAULT_MYBATIS_MAPPING_FILE = "org/activiti/db/mapping/mappings.xml";
…….
protected InputStream getMyBatisXmlConfigurationSteam() {
return ReflectUtil.getResourceAsStream(DEFAULT_MYBATIS_MAPPING_FILE);
}
</blockcode>
My mappings.xml
<blockcode>
<configuration>
<settings>
<setting name="lazyLoadingEnabled" value="false" />
</settings>
<typeAliases>
<typeAlias type="org.activiti.engine.impl.persistence.ByteArrayRefTypeHandler" alias="ByteArrayRefTypeHandler"/>
</typeAliases>
<typeHandlers>
<typeHandler handler="ByteArrayRefTypeHandler"
javaType="org.activiti.engine.impl.persistence.entity.ByteArrayRef"
jdbcType="VARCHAR"/>
</typeHandlers>
<mappers>
<mapper resource="org/activiti/db/mapping/entity/Attachment.xml" />
<mapper resource="org/activiti/db/mapping/entity/ByteArray.xml" />
<mapper resource="org/activiti/db/mapping/entity/Comment.xml" />
<mapper resource="org/activiti/db/mapping/entity/Deployment.xml" />
<mapper resource="org/activiti/db/mapping/entity/Execution.xml" />
<mapper resource="org/activiti/db/mapping/entity/HistoricActivityInstance.xml" />
<mapper resource="org/activiti/db/mapping/entity/HistoricDetail.xml" />
<mapper resource="org/activiti/db/mapping/entity/HistoricProcessInstance.xml" />
<mapper resource="org/activiti/db/mapping/entity/HistoricVariableInstance.xml" />
<mapper resource="org/activiti/db/mapping/entity/HistoricTaskInstance.xml" />
<mapper resource="org/activiti/db/mapping/entity/HistoricIdentityLink.xml" />
<mapper resource="org/activiti/db/mapping/entity/IdentityLink.xml" />
<mapper resource="org/activiti/db/mapping/entity/Job.xml" />
<mapper resource="org/activiti/db/mapping/entity/Model.xml" />
<mapper resource="org/activiti/db/mapping/entity/ProcessDefinition.xml" />
<mapper resource="org/activiti/db/mapping/entity/Property.xml" />
<mapper resource="org/activiti/db/mapping/entity/Resource.xml" />
<mapper resource="org/activiti/db/mapping/entity/TableData.xml" />
<mapper resource="org/activiti/db/mapping/entity/Task.xml" />
<mapper resource="org/activiti/db/mapping/entity/VariableInstance.xml" />
<mapper resource="org/activiti/db/mapping/entity/EventSubscription.xml" />
<!–My IdentityService –>
<mapper resource="org/activiti/db/mapping/entity/User.xml" />
<mapper resource="org/activiti/db/mapping/entity/IdentityInfo.xml" />
<mapper resource="org/activiti/db/mapping/entity/Group.xml" />
<mapper resource="org/activiti/db/mapping/entity/Membership.xml" />
</mappers>
</configuration>
</blockcode>
I suggest that, in new version, can make the mybatis mappings.xml to be custome, then Activiti will be more easier to fit our project.