Flowable 6.6.0 用户指南相关文档下载
- BPMN用户指南 第一部分 - 中文PDF精编版
- BPMN用户指南 第二部分 - 中文PDF精编版
- BPMN用户指南 第三部分 - 中文PDF精编版
- 应用程序指南 - 中文PDF精编版
- 应用程序指南 - 中英对照PDF精编版
- 应用程序指南 - Eclipse设计器中文PDF精编版
- 表单用户指南 - 中文PDF精编版
- 事件注册表用户指南 - 中文PDF精编版
《Flowable 6.6.0应用指南》
- Flowable应用程序概述
- Flowable UI应用安装
- Flowable UI应用配置(1)
- Flowable UI应用配置(2)
- Flowable UI应用配置(3)
- Flowable身份管理应用程序(1)
- Flowable身份管理应用程序(2)
- Flowable 建模器应用程序(1)
- Flowable 建模器应用程序(2)
- Flowable 建模器应用程序(3)
- Flowable 建模器应用程序(4)
- Flowable 任务应用程序
- Flowable 管理应用程序(1)
- Flowable 管理应用程序(2)
- 国际化(Internationalization)
- 生产就绪端点(Production-ready endpoints)
- 自定义bean部署
自定义bean部署(Custom bean deployment)
There are multiple ways of providing custom beans to the Flowable application.
有多种方法可以向Flowable应用程序提供自定义bean。
1.使用Spring Boot 自动配置(Using Spring Boot auto configuration)
The Flowable application is a Spring Boot 2 application. This means that normal Spring Boot auto configuration can be used to make the beans to Flowable. This can be done in the following manner
Flowable应用程序是一个Spring Boot 2应用程序。这意味着可以使用正常的Spring Boot 自动配置来使bean可部署到Flowable。这可以通过以下方式完成
package com.your.own.package.configuration;
@Configuration
@AutoConfigureOrder(Ordered.LOWEST_PRECEDENCE) // Makes sure that this configuration will be processed last by Spring Boot
@ConditionalOnBean(type = "org.flowable.engine.ProcessEngine") // The configuration will only be used when the ProcessEngine bean is present
public class YourOwnConfiguration {
@Configuration
@ComponentScan ("com.your.own.package.beans")
public static class ComponentScanConfiguration {
// This class is needed in order to conditionally perform the component scan (i.e. when the ProcessEngine bean is present)
// It is an optional class, in case you don't need component scanning then you don't need to do this
}
@Bean
public CustomBean customBean() {
// create your bean
}
@Bean
public EngineConfigurationConfigurer<SpringProcessEngineConfiguration> customProcessEngineConfigurationConfigurer() {
return engineConfiguration -> {
// You can use this to add extra configuration to the process engine
}
}
}
Note that when using Spring Boot the configuration class can be under your own package and not under some Flowable package.
请注意,当使用Spring Boot时,配置类可以在您自己的包下,而不是在某个Flowable的包下。
In order to make this class an auto configuration class a file named spring.factories should be created in the META-INF folder of your jar. In this file you should add
为了使这个类成为一个自动配置类,应该在jar的META-INF文件夹中创建一个名为 spring.factories。在这个文件中,你应该添加
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.your.own.package.configuration.YourOwnCustomConfiguration
In order to use this approach you would need to include your jar in the WEB-INF/lib folder of the exploded war. Placing this jar in the lib folder of the servlet container (e.g. Tomcat) is not going to work due to the way Spring proxies the @Configuration classes.
为了使用这种方法,您需要将您的jar包含在解压后的war的WEB-INF/lib文件夹中。由于Spring代理@Configuration类的方式,将这个jar放在servlet容器(例如Tomcat)的lib文件夹中是行不通的。
2.组件扫描(Component scan)
Another way to provide custom Spring beans to the Flowable engine is to put them under a certain package and have the Flowable application component scan that package. Based on the application used, this package is different:
另一种向Flowable引擎提供定制Spring bean的方法是:将它们放在某个包下,然后让Flowable应用程序组件扫描该包。根据所使用的应用程序,此软件包有所不同:
- org.flowable.rest.app for the flowable-rest.war
- org.flowable.ui.application for the flowable-ui.war
The custom beans can be located in a single JAR and this jar should be present on the classpath when the application is starting up. Depending where there JAR is placed, the lib folder of the servlet container (e.g. Tomcat) or the WEB-INF/lib folder of the exploded war, there are different possibilities.
自定义bean可以位于单个JAR中,当应用程序启动时,这个JAR应该出现在classpath上。根据JAR的放置位置、servlet容器的lib文件夹(例如Tomcat),或被解压缩的war的WEB-INF/lib文件夹,存在不同的可能性。
When using the lib folder of the servlet container then the created classes should be self contained, i.e. they should only use classes from within the jar. You can use any of the Spring @Component annotations (with the exception of @Configuration). The reason for not being able to use @Configuration classes is the fact that each configuration class is proxied by Spring with the help of the ConfigurationClassPostProcessor. However, the classloader loading the @Configuration class does not have access to the needed classes by Spring.
When including the jar in the WEB-INF/lib folder of the exploded war then @Configuration classes and dependencies to other jars is possible.
当使用servlet容器的lib文件夹时,创建的类应该是自包含的,也就是说,它们应该只使用jar中的类。您可以使用任何Spring @Component注释(除了 @Configuration)。不能使用 @Configuration类的原因是每个配置类都由Spring在ConfigurationClassPostProcessor的帮助下代理(proxied)。但是,加载 @Configuration类的类加载器无法通过Spring访问所需的类。
当将jar包含在被解压缩的war的WEB-INF/lib文件夹中时, @Configuration类和对其他jar的依赖是可用的。
3.创建自己的Spring Boot 应用程序(Creating your own Spring Boot application)
This approach is the most flexible and most powerful approach of all. In order to follow this approach have a look at the Getting Started with Spring Boot section of this documentation.
这种方法是所有方法中最灵活和最强大的方法。为了遵循这种方法,请看一下文档中的Spring Boot入门部分(Getting Started with Spring Boot)。