diff --git a/adapter/flowable-spring-boot-jpa-starter/src/main/java/com/lanyuanxiaoyao/flowable/jpa/SpringFlowableAutoConfiguration.java b/adapter/flowable-spring-boot-jpa-starter/src/main/java/com/lanyuanxiaoyao/flowable/jpa/SpringFlowableAutoConfiguration.java index 699d5dc..d43c812 100644 --- a/adapter/flowable-spring-boot-jpa-starter/src/main/java/com/lanyuanxiaoyao/flowable/jpa/SpringFlowableAutoConfiguration.java +++ b/adapter/flowable-spring-boot-jpa-starter/src/main/java/com/lanyuanxiaoyao/flowable/jpa/SpringFlowableAutoConfiguration.java @@ -1,6 +1,5 @@ package com.lanyuanxiaoyao.flowable.jpa; -import com.lanyuanxiaoyao.flowable.core.manager.FlowableConfiguration; import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager; import com.lanyuanxiaoyao.flowable.core.repository.FlowableRepository; import com.lanyuanxiaoyao.flowable.jpa.repository.FlowableHistoryRepository; @@ -12,6 +11,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; @@ -22,13 +22,14 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories; * @version 20250103 */ @Configuration +@ComponentScan @EnableJpaRepositories("com.lanyuanxiaoyao.flowable.jpa.repository") @EnableConfigurationProperties(SpringFlowableConfiguration.class) public class SpringFlowableAutoConfiguration { - @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") + @Bean @ConditionalOnMissingBean(FlowableRepository.class) - public FlowableRepository flowableRepository( + public SpringFlowableRepository flowableRepository( FlowableNodeRepository flowableNodeRepository, FlowableInstanceRepository flowableInstanceRepository, FlowableHistoryRepository flowableHistoryRepository @@ -39,12 +40,12 @@ public class SpringFlowableAutoConfiguration { @Bean @ConditionalOnBean(FlowableRepository.class) @ConditionalOnMissingBean(FlowableManager.class) - public FlowableManager flowableManager( - FlowableConfiguration configuration, - FlowableRepository repository, + public SpringFlowableManager flowableManager( + SpringFlowableConfiguration configuration, + SpringFlowableRepository repository, ApplicationContext applicationContext ) { - FlowableManager manager = new SpringFlowableManager(configuration, repository, applicationContext); + SpringFlowableManager manager = new SpringFlowableManager(configuration, repository, applicationContext); Map initializerMap = applicationContext.getBeansOfType(SpringFlowableManagerInitializer.class); for (SpringFlowableManagerInitializer initializer : initializerMap.values()) { diff --git a/adapter/flowable-spring-boot-jpa-starter/src/main/java/com/lanyuanxiaoyao/flowable/jpa/SpringFlowableManager.java b/adapter/flowable-spring-boot-jpa-starter/src/main/java/com/lanyuanxiaoyao/flowable/jpa/SpringFlowableManager.java index f9ccb78..09e7ac8 100644 --- a/adapter/flowable-spring-boot-jpa-starter/src/main/java/com/lanyuanxiaoyao/flowable/jpa/SpringFlowableManager.java +++ b/adapter/flowable-spring-boot-jpa-starter/src/main/java/com/lanyuanxiaoyao/flowable/jpa/SpringFlowableManager.java @@ -1,12 +1,15 @@ package com.lanyuanxiaoyao.flowable.jpa; -import com.lanyuanxiaoyao.flowable.core.manager.FlowableConfiguration; import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager; -import com.lanyuanxiaoyao.flowable.core.repository.FlowableRepository; +import com.lanyuanxiaoyao.flowable.jpa.entity.FlowableHistory; +import com.lanyuanxiaoyao.flowable.jpa.entity.FlowableInstance; +import com.lanyuanxiaoyao.flowable.jpa.entity.FlowableNode; +import java.util.List; import java.util.UUID; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.context.ApplicationContext; +import org.springframework.data.jpa.domain.Specification; /** * @author lanyuanxiaoyao @@ -14,11 +17,13 @@ import org.springframework.context.ApplicationContext; */ @Slf4j public class SpringFlowableManager extends FlowableManager { + private final SpringFlowableRepository repository; private final ApplicationContext applicationContext; - public SpringFlowableManager(FlowableConfiguration configuration, FlowableRepository repository, ApplicationContext applicationContext) { + public SpringFlowableManager(SpringFlowableConfiguration configuration, SpringFlowableRepository repository, ApplicationContext applicationContext) { super(configuration, repository); log.info("Configuration: {}", configuration); + this.repository = repository; this.applicationContext = applicationContext; } diff --git a/adapter/flowable-spring-boot-jpa-starter/src/main/java/com/lanyuanxiaoyao/flowable/jpa/SpringFlowableManagerInitializer.java b/adapter/flowable-spring-boot-jpa-starter/src/main/java/com/lanyuanxiaoyao/flowable/jpa/SpringFlowableManagerInitializer.java index 6fe4220..8010b18 100644 --- a/adapter/flowable-spring-boot-jpa-starter/src/main/java/com/lanyuanxiaoyao/flowable/jpa/SpringFlowableManagerInitializer.java +++ b/adapter/flowable-spring-boot-jpa-starter/src/main/java/com/lanyuanxiaoyao/flowable/jpa/SpringFlowableManagerInitializer.java @@ -1,11 +1,9 @@ package com.lanyuanxiaoyao.flowable.jpa; -import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager; - /** * @author lanyuanxiaoyao * @version 20250106 */ public interface SpringFlowableManagerInitializer { - FlowableManager initial(FlowableManager manager); + SpringFlowableManager initial(SpringFlowableManager manager); }