Comments (5)
`@Order
@configuration
@ConditionalOnClass(SmartEngine.class)
@slf4j
public class SmartEngineAutoConfiguration implements ApplicationContextAware {
private ApplicationContext applicationContext;
@Bean
@ConditionalOnMissingBean
public SmartEngine constructSmartEngine() {
ProcessEngineConfiguration processEngineConfiguration = new DefaultProcessEngineConfiguration();
// 自定义处理类获取
processEngineConfiguration.setInstanceAccessor(new CustomInstanceAccessService());
// see https://github.com/alibaba/SmartEngine/wiki/SmartEngine-UserGuide--Chinese-Version-(%E4%B8%AD%E6%96%87%E7%89%88)#usertask
// UserTask是DataBase模式下特有的功能。
// UserTask和TaskAssigneeDispatcher,待办列表(TaskInstance)紧密关联。 通过TaskAssigneeDispatcher,可以实现自动获取某个节点的任务处理者
processEngineConfiguration.setTaskAssigneeDispatcher(new DefaultTaskAssigneeDispatcher());
// 自定义 processInstanceId 生成
processEngineConfiguration.setIdGenerator(new CustomerIdGenerator());
// 自定义锁
processEngineConfiguration.setLockStrategy(new DefaultLockStrategy());
// SimpleAnnotationScanner scanner = new SimpleAnnotationScanner("com.alibaba.smart.framework.engine.persister.database",
// "com.alibaba.smart.framework.engine.service");
// processEngineConfiguration.setAnnotationScanner(scanner);
SmartEngine smartEngine = new DefaultSmartEngine();
smartEngine.init(processEngineConfiguration);
deployProcessDefinition(smartEngine);
return smartEngine;
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
private class CustomInstanceAccessService implements InstanceAccessor {
@Override
public Object access(String name) {
try {
return applicationContext.getBean(name);
} catch (BeansException e) {
log.error("smart engine 获取 bean 异常", e);
throw e;
}
}
}
private void deployProcessDefinition(SmartEngine smartEngine) {
RepositoryCommandService repositoryCommandService = smartEngine
.getRepositoryCommandService();
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
try {
Resource[] resources = resolver.getResources("smart-engine/*.xml");
for (Resource resource : resources) {
InputStream inputStream = resource.getInputStream();
repositoryCommandService.deploy(inputStream);
IOUtil.closeQuietly(inputStream);
}
} catch (Exception e) {
throw new EngineException(e);
}
}
/**
* 自定义 processInstanceId 生成
*/
private static class CustomerIdGenerator implements IdGenerator {
private static final Sequence SEQUENCE = new Sequence(null);
@Override
public void generate(Instance instance) {
instance.setInstanceId(String.valueOf(SEQUENCE.nextId()));
}
}
}`
from smartengine.
这是我的配置
from smartengine.
我理解应该是需要自定义 SimpleAnnotationScanner 的扫描路径,但是不知道需要哪些
from smartengine.
目前不能同时在一个应用内部署2种模式
from smartengine.
目前不能同时在一个应用内部署2种模式
ok
from smartengine.
Related Issues (20)
- 设计器还开源不 HOT 3
- mysql 数据库自增 主键没有回填 HOT 3
- 顺序会签导致流产abort HOT 5
- 同学,您这个项目引入了161个开源组件,存在7个漏洞,辛苦升级一下
- http://smartengine.org/schema/process 无法访问 HOT 2
- 可以根据业务场景多写几个Demo应该会推广的更快 HOT 5
- 示例太少 HOT 2
- 请问流程节点间参数怎么传递的,能提供一个demo吗 HOT 1
- 请问jumpTo和jumpFrom的使用场景是什么 HOT 4
- 大佬,Java基本代码规范能注意一下吗?太自由了:( HOT 1
- java.lang.NumberFormatException: For input string: "0dac1945-c1c6-4dec-b175-b5871d153da7" HOT 3
- mapper.xml加载不了 HOT 4
- 打算支持自定义表单吗 HOT 2
- smart-engine-core 3.0.0 并行网关异常处理
- smart-engine-core 3.0.0 并行网关异常处理 HOT 6
- 为什么我把数据源从H2替换为mysql后,运行示例,数据库里没有产生数据? HOT 1
- 请问下在高并发的查询场景(比如搜索)下性能怎么样?还有就是支持jdk17吗? HOT 1
- 考虑未来加入历史记录表吗? HOT 3
- "也需要将新类报名放在这个子包里面:com.alibaba.smart.framework.engine 里面,便于包扫描"请问这个是必须的,目前看好像扫描不到其他位置,有没有其他解决方案呢 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smartengine.