mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-15 12:32:09 +08:00
增加liteflow-springboot-starter
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package com.thebeastshop.liteflow.springboot;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.spring.ComponentScaner;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnProperty(name = "liteflow.ruleSource")
|
||||
public class LiteflowAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public ComponentScaner componentScaner(){
|
||||
return new ComponentScaner();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FlowExecutor flowExecutor(LiteflowProperty property){
|
||||
if(StringUtils.isNotBlank(property.getRuleSource())){
|
||||
List<String> ruleList = Lists.newArrayList(property.getRuleSource().split(","));
|
||||
FlowExecutor flowExecutor = new FlowExecutor();
|
||||
flowExecutor.setRulePath(ruleList);
|
||||
return flowExecutor;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.thebeastshop.liteflow.springboot;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class LiteflowProperty {
|
||||
|
||||
@Value("${liteflow.ruleSource}")
|
||||
private String ruleSource;
|
||||
|
||||
public String getRuleSource() {
|
||||
return ruleSource;
|
||||
}
|
||||
|
||||
public void setRuleSource(String ruleSource) {
|
||||
this.ruleSource = ruleSource;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user