ProcessRuntimeImpl.builder() 这种写法是错误的
时间: 2024-03-06 16:49:26 浏览: 65
非常抱歉,我的回答中存在错误。在 Activiti 7 中,ProcessRuntimeImpl 的构造函数是私有的,因此不能直接使用 new 关键字来创建 ProcessRuntimeImpl 实例。
正确的创建 ProcessRuntimeImpl 实例的方法是使用 ProcessRuntimeBuilder 类的 builder() 方法,如下所示:
```
ProcessRuntime processRuntime = ProcessRuntimeBuilder
.builder()
.processEngine(processEngine)
.build();
```
在这个示例中,我们使用 ProcessRuntimeBuilder 创建了 ProcessRuntime 实例,并将其与 ProcessEngine 绑定。然后,我们可以将其注入到我们的服务中,如下所示:
```
@Service
public class MyService {
@Autowired
private ProcessRuntime processRuntime;
// ...
}
```
非常感谢您指出我的错误,希望这次回答能够解决您的疑惑。
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044833.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![application/octet-stream](https://img-home.csdnimg.cn/images/20210720083646.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)