标签:工作流 img page pat exception mic hbm net scan
关于若依分模块创建项目可参考:https://www.cnblogs.com/conswin/p/9766186.html
了解uflo2,uflo2是一套由BSTEK自主研发的基于Java的工作流引擎,它以Spring为基础框架,采用Hibernate作为持久层,可运行于所有主流程应用服务器及流数据库之上的轻量级流程引擎。
其官方说明文档可参看:http://wiki.bsdn.org/pages/viewpage.action?pageId=30441763
下面主要记录一下若依项目中集成uflo2的具体步骤:
①、创建maven module项目取名为【ruoyi-uflo】,父项目选取若依的父项目,对应pom.xml中加入uflo依赖。记得将【ruoyi-uflo】依赖加入到【ruoyi-framework】中。
<description> uflo2流程管理模块 </description> <properties> <uflo.version>2.1.4</uflo.version> </properties> <dependencies> <!-- uflo2依赖包--> <dependency> <groupId>com.bstek.uflo</groupId> <artifactId>uflo-console</artifactId> <version>${uflo.version}</version> </dependency> <!-- 通用工具--> <dependency> <groupId>com.ruoyi</groupId> <artifactId>ruoyi-common</artifactId> <version>${ruoyi.version}</version> </dependency> </dependencies>
②、按下图所示,创建servletConfig、UfloConfig、TestEvnironmentProvide:
·
servletConfig具体代码:
@Configuration public class ServletConfig { @Bean public ServletRegistrationBean buildUfloServlet(){ return new ServletRegistrationBean(new UfloServlet(),"/uflo/*"); } }
UFloConfig具体代码:
@Configuration public class UfloConfig { @Bean("localSessionFactoryBean") public LocalSessionFactoryBean localSessionFactoryBean(DataSource dataSource) throws PropertyVetoException, IOException { LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean(); sessionFactoryBean.setDataSource(dataSource); sessionFactoryBean.setPackagesToScan("com.bstek.uflo.model*"); Properties prop = new Properties(); prop.put("hibernate.dialect","org.hibernate.dialect.MySQL5Dialect"); prop.put("hibernate.show_sql",false); prop.put("hibernate.hbm2ddl.auto","update"); prop.put("hibernate.jdbc.batch_size",100); sessionFactoryBean.setHibernateProperties(prop); return sessionFactoryBean; } @Bean("ufloTransactionManager") public HibernateTransactionManager ufloTransactionManager(SessionFactory sessionFactory){ HibernateTransactionManager hi = new HibernateTransactionManager(); hi.setSessionFactory(sessionFactory); return hi; } }
TestEvnironmentProvide具体代码:
@Component public class TestEnvironmentProvider implements EnvironmentProvider { @Autowired private SessionFactory sessionFactory; @Resource(name = "ufloTransactionManager") private PlatformTransactionManager platformTransactionManager; @Override public SessionFactory getSessionFactory() { return sessionFactory; } public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } @Override public PlatformTransactionManager getPlatformTransactionManager() { return platformTransactionManager; } public void setPlatformTransactionManager(PlatformTransactionManager platformTransactionManager) { this.platformTransactionManager = platformTransactionManager; } @Override public String getLoginUser() { return null; } @Override public String getCategoryId() { return "anonymous"; } }
③、打开ruoyi-admin的配置启动类RuoYiApplication.java,导入uflo的配置文件,如下代码:
@ImportResource("classpath:uflo-console-context.xml")
④、启动若依,会自动在数据库生成uflo相应的数据表,访问:【待办任务】http://localhost/uflo/todo 或者 【流程设计】http://localhost/uflo/designer来验证是否集成成功。
参考文档:https://blog.csdn.net/zh_yi/article/details/82423967#commentBox
感谢若依群里大牛【表面】的技术支持。
标签:工作流 img page pat exception mic hbm net scan
原文地址:https://www.cnblogs.com/conswin/p/9803122.html