增加spring boot自动配置
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
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;
|
||||
import com.lanyuanxiaoyao.flowable.jpa.repository.FlowableInstanceRepository;
|
||||
import com.lanyuanxiaoyao.flowable.jpa.repository.FlowableNodeRepository;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 自动配置
|
||||
*
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250103
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(SpringFlowableConfiguration.class)
|
||||
public class SpringFlowableAutoConfiguration {
|
||||
@Bean
|
||||
public FlowableRepository flowableRepository(
|
||||
FlowableNodeRepository flowableNodeRepository,
|
||||
FlowableInstanceRepository flowableInstanceRepository,
|
||||
FlowableHistoryRepository flowableHistoryRepository
|
||||
) {
|
||||
return new SpringFlowableRepository(flowableNodeRepository, flowableInstanceRepository, flowableHistoryRepository);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FlowableManager flowableManager(
|
||||
@Qualifier("springFlowableConfiguration") FlowableConfiguration configuration,
|
||||
FlowableRepository repository,
|
||||
ApplicationContext applicationContext
|
||||
) {
|
||||
return new SpringFlowableManager(configuration, repository, applicationContext);
|
||||
}
|
||||
}
|
||||
@@ -7,14 +7,12 @@ import java.util.UUID;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20241231
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SpringFlowableManager extends FlowableManager {
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -10,13 +10,11 @@ import com.lanyuanxiaoyao.flowable.jpa.repository.FlowableNodeRepository;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.transaction.Transactional;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20241231
|
||||
*/
|
||||
@Service
|
||||
public class SpringFlowableRepository implements FlowableRepository {
|
||||
private final FlowableNodeRepository flowableNodeRepository;
|
||||
private final FlowableInstanceRepository flowableInstanceRepository;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.lanyuanxiaoyao.flowable.jpa.SpringFlowableAutoConfiguration
|
||||
Reference in New Issue
Block a user