Package Com.tabchanj.activiti;import Org.activiti.engine.processengine;import Org.activiti.engine.processengineconfiguration;import Org.activiti.engine.processengines;import org.junit.Test; Public classEnvtest {/** * Create Processengine Mode 1: Use configuration objects directly, set database connection information, and automatically build and build tables * * @throws Exception*/@Test Public voidtestname () throws Exception {processengineconfiguration config=processengineconfiguration.createstandaloneprocessengineconfiguration (); Config.setjdbcdriver ("Com.mysql.jdbc.Driver"); Config.setjdbcurl ("jdbc:mysql://localhost:3306/activiti?createdatabaseifnotexist=true"); Config.setjdbcusername ("Root"); Config.setjdbcpassword ("4230"); Config.setdatabaseschemaupdate (processengineconfiguration.db_schema_update_true); Processengine engine=Config.buildprocessengine (); System. out. println (engine); System. out. println (engine); } /** * Method 2: Create processengine with configuration file * * @throws Exception*/@Test Public voidTestxml () throws Exception {processengineconfiguration config=processengineconfiguration. Createprocessengineconfigurationfromresource ("Activiti.cfg.xml"); Processengine engine=Config.buildprocessengine (); System. out. println (engine); } /** * Mode 3: The default way, you need to ensure that the configuration file name is activiti.cfg.xml * * @throws Exception*/@Test Public voidTestdefault () throws Exception {Processengine engine=Processengines.getdefaultprocessengine (); System. out. println (engine); }}
Activiti Workflow Core-----Processengine 3 Creation method