jbpm4.4 +Spring mvc 整合架构

1.配置spring mvc 如下
<?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:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"  
xmlns:mvc="http://www.springframework.org/schema/mvc"  
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/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">


<!-- 使用 annotation -->
<context:annotation-config />
<!-- 使用 annotation 自动注册bean,并检查@Controller, @Service, @Repository注解已被注入 -->
<context:component-scan base-package="com.platform" />




<!-- 此bean告诉Spring去哪找数据库的配置信息,因为有此Bean才出现下面用${}标记来取变量的语句 -->
<bean id="propertyConfig"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:config.properties</value>
</property>
</bean>




<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  <property name="driverClassName">
    <value>${jdbc.driver}</value>
  </property>
  <property name="username">
    <value>${jdbc.username}</value>
  </property>
  <property name="password">
    <value>${jdbc.password}</value>
  </property>
  <property name="url">
    <value>${jdbc.url}</value>
  </property>
</bean>


<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
  <!-- 此处应注入ibatis配置文件,而非sqlMap文件,否则会出现“there is no statement.....异常” -->
  <property name="configLocation">
     <value>classpath:config/ibatis/sqlMapConfig.xml</value>
  </property>
</bean>


<!-- dao 持久层 配置数据源 -->
<bean id="com.platform.ibatis.dao.impl.IbatisDAOImpl" class="com.platform.ibatis.dao.impl.IbatisDAOImpl">
   <property name="dataSource">
   <ref bean="dataSource"/>
 </property>
  <property name="sqlMapClient">
    <ref bean="sqlMapClient"/>
  </property>
</bean>
<!-- 自动绑定对象 -->
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" />


<!-- 事务管理器 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- 用注解来实现事务管理 -->
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
  
 


<!-- end  -->


<!--     启动Spring MVC的注解功能 -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
</bean>
<!-- Configures the @Controller programming model -->
<mvc:annotation-driven />
 
 
 
</beans>


2.配置 jbpm4.4


<?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:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"  
xmlns:mvc="http://www.springframework.org/schema/mvc"  
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/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">


<bean id="sessionFactoryJBPM" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">   
        <property name="dataSource" ref="dataSource" />   
        
        <!-- 
        <property name="packagesToScan" value="com.boda.model"/>
         -->   
        <property name="hibernateProperties">   
            <props>   
                <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>   
                <prop key="hibernate.show_sql">true</prop>   
                <prop key="hibernate.hbm2ddl.auto">false</prop>   
            </props>   
        </property>   
           
           
        <property name="mappingLocations">   
            <list>   
                <value>classpath:jbpm.execution.hbm.xml</value>   
                <value>classpath:jbpm.history.hbm.xml</value>   
                <value>classpath:jbpm.identity.hbm.xml</value>   
                <value>classpath:jbpm.repository.hbm.xml</value>   
                <value>classpath:jbpm.task.hbm.xml</value>   
            </list>   
        </property>   
           
           
    </bean>   
 
<bean id="transactionManagerJBPM" class="org.springframework.orm.hibernate3.HibernateTransactionManager">   
        <property name="sessionFactory" ref="sessionFactoryJBPM"/>   
    </bean>   
       
    <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">   
        <property name="dataSource" ref="dataSource"/>   
    </bean>   
       
    <bean class="org.springframework.transaction.support.TransactionTemplate">   
        <constructor-arg ref="transactionManagerJBPM"></constructor-arg>   
    </bean>   
    <!-- 
    <tx:annotation-driven/>   
 -->
 <!-- jbpm工作流 -->   
    <bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper">   
        <property name="jbpmCfg" value="config/jbpm/spring-jbpm4.cfg.xml"></property>   
    </bean>   
    <bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine">   
    </bean>   
    
    <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />


    <bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />


    <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService"/>


    <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService"/>


    <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService"/>
    


    <!--


    <bean id="jbpmTemplate" class="com.bmsoft.jbpm.spring.JbpmTemplate">


       <property name="processEngine" ref="processEngine"/>


       <property name="proDefinitionService" ref="proDefinitionService"/>


       <property name="dataSource" ref="dataSource"/>


    </bean>


     -->
    
</beans>



3.添加响应jar包。

4.添加 ejb3-persistence.jar


你可能感兴趣的:(jbpm4.4 +Spring mvc 整合架构)