Camunda JavaDelegate另一种实现
- lambada实现
@Configuration public class CommonDelegate { @Bean("test") JavaDelegate testDelegate() { return execution -> { System.out.println("test>>>>>"); Map<String,String> map = new HashMap<>(); execution.setVariable("map",map); execution.setVariable("jname", UUID.randomUUID().toString()); execution.setVariable("jage", System.nanoTime()); }; } }
Expression的使用
${myBean.doWork(execution)} @Component("myBean") public class MyService { public void doWork(DelegateExecution execution) { System.out.println("myBean:doWork>>>>>>"); Object jname = execution.getVariable("jname"); execution.setVariable("jname", jname + "zzzzz"); } } map,jname必須是variables里的变量