ProcessEngineAutoConfiguration extends AbstractProcessEngineAutoConfiguration { protected void addAsyncPropertyValidator(ActivitiProperties activitiProperties, SpringProcessEngineConfiguration conf) { if (!activitiProperties.isAsyncExecutorActivate()) { ValidatorSet springBootStarterValidatorSet = new ValidatorSet("activiti-spring-boot-starter"); springBootStarterValidatorSet.addValidator(new AsyncPropertyValidator()); if (conf.getProcessValidator() == null) { ProcessValidatorImpl processValidator = new ProcessValidatorImpl(); processValidator.addValidatorSet(springBootStarterValidatorSet); conf.setProcessValidator(processValidator); } else { conf.getProcessValidator().getValidatorSets().add(springBootStarterValidatorSet); } } } ProcessEngineAutoConfiguration(UserGroupManager userGroupManager); @Bean @ConditionalOnMissingBean SpringProcessEngineConfiguration springProcessEngineConfiguration(
            DataSource dataSource,
            PlatformTransactionManager transactionManager,
            SpringAsyncExecutor springAsyncExecutor,
            ActivitiProperties activitiProperties,
            ResourceFinder resourceFinder,
            List<ResourceFinderDescriptor> resourceFinderDescriptors,
            ApplicationUpgradeContextService applicationUpgradeContextService,
            @Autowired(required = false) List<ProcessEngineConfigurationConfigurer> processEngineConfigurationConfigurers,
            @Autowired(required = false) List<ProcessEngineConfigurator> processEngineConfigurators); @Bean @ConditionalOnMissingBean ProcessDefinitionResourceFinderDescriptor processDefinitionResourceFinderDescriptor(ActivitiProperties activitiProperties); @Bean @ConditionalOnMissingBean ProcessExtensionResourceFinderDescriptor processExtensionResourceFinderDescriptor(ActivitiProperties activitiProperties,
                                                                                             @Value("${spring.activiti.process.extensions.dir:NOT_DEFINED}") String locationPrefix,
                                                                                             @Value("${spring.activiti.process.extensions.suffix:**-extensions.json}") String locationSuffix); @Bean @ConditionalOnMissingBean ProcessDeployedEventProducer processDeployedEventProducer(RepositoryService repositoryService,
                                                                     APIProcessDefinitionConverter converter,
                                                                     @Autowired(required = false) List<ProcessRuntimeEventListener<ProcessDeployedEvent>> listeners,
                                                                     ApplicationEventPublisher eventPublisher); @Bean @ConditionalOnMissingBean StartMessageDeployedEventProducer startMessageDeployedEventProducer(RepositoryService repositoryService,
                                                                               ManagementService managementService,
                                                                               StartMessageSubscriptionConverter subscriptionConverter,
                                                                               APIProcessDefinitionConverter converter,
                                                                               List<ProcessRuntimeEventListener<StartMessageDeployedEvent>> listeners,
                                                                               ApplicationEventPublisher eventPublisher); @Bean(name = BEHAVIOR_FACTORY_MAPPING_CONFIGURER) @ConditionalOnMissingBean(name = BEHAVIOR_FACTORY_MAPPING_CONFIGURER) DefaultActivityBehaviorFactoryMappingConfigurer defaultActivityBehaviorFactoryMappingConfigurer(
        ExtensionsVariablesMappingProvider variablesMappingProvider,
                                                                                                           ProcessVariablesInitiator processVariablesInitiator,
                                                                                                           EventSubscriptionPayloadMappingProvider eventSubscriptionPayloadMappingProvider); @Bean @Order(Ordered.HIGHEST_PRECEDENCE) ProcessEngineConfigurationConfigurer asyncExecutorPropertiesConfigurer(AsyncExecutorProperties properties); static final String BEHAVIOR_FACTORY_MAPPING_CONFIGURER; }
@Test public void shouldAddAsyncPropertyValidatorWhenAsyncExecutorIsEnabled() { ActivitiProperties activitiProperties = new ActivitiProperties(); activitiProperties.setAsyncExecutorActivate(false); SpringProcessEngineConfiguration conf = new SpringProcessEngineConfiguration(applicationUpgradeContextServiceMock); processEngineAutoConfiguration.addAsyncPropertyValidator(activitiProperties, conf); ProcessValidator processValidator = conf.getProcessValidator(); assertThat(processValidator).isNotNull(); assertThat(processValidator.getValidatorSets()) .flatExtracting(ValidatorSet::getValidators) .haveExactly(1, new Condition<>(validator -> validator instanceof AsyncPropertyValidator, "instance of AsyncPropertyValidator")); }
@Test public void shouldNotAddAsyncPropertyValidatorWhenAsyncExecutorIsDisabled() { ActivitiProperties activitiProperties = new ActivitiProperties(); activitiProperties.setAsyncExecutorActivate(true); SpringProcessEngineConfiguration conf = new SpringProcessEngineConfiguration(applicationUpgradeContextServiceMock); processEngineAutoConfiguration.addAsyncPropertyValidator(activitiProperties, conf); ProcessValidator processValidator = conf.getProcessValidator(); assertThat(processValidator).isNull(); }