增加liteflow-springboot-starter

This commit is contained in:
bryan.zhang
2019-03-21 19:54:42 +08:00
parent 6a39a6771e
commit 6c3eaedbec
65 changed files with 342 additions and 193 deletions

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}