添加注释

This commit is contained in:
bryan31
2021-03-24 01:29:15 +08:00
parent 458f7ce50f
commit acee106b29
17 changed files with 83 additions and 36 deletions

View File

@@ -4,8 +4,12 @@ import com.yomahub.liteflow.spring.ComponentScaner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 组件扫描器自动装配类
* @author Bryan.Zhang
*/
@Configuration
public class LiteflowComponentScanerAutoConfiguration {
public class LiteflowComponentScannerAutoConfiguration {
@Bean
public ComponentScaner componentScaner(){

View File

@@ -4,6 +4,11 @@ import com.yomahub.liteflow.core.FlowExecutor;
import org.springframework.beans.factory.InitializingBean;
import javax.annotation.Resource;
/**
* 执行器初始化类
* 主要用于在启动时执行执行器的初始化方法,避免在运行执行器时第一次初始化而耗费时间
* @author Bryan.Zhang
*/
public class LiteflowExecutorInit implements InitializingBean {
private FlowExecutor flowExecutor;

View File

@@ -21,13 +21,16 @@ import org.springframework.context.annotation.PropertySource;
import javax.swing.*;
import java.util.List;
/**
* 主要的业务装配器
* 在这个装配器里装配了执行器,执行器初始化类,监控器
* 这个装配前置条件是需要LiteflowConfigLiteflowPropertyAutoConfiguration以及SpringAware
* @author Bryan.Zhang
*/
@Configuration
@ConditionalOnBean(LiteflowConfig.class)
@AutoConfigureAfter(LiteflowPropertyAutoConfiguration.class)
@Import(SpringAware.class)
@PropertySource(
name = "Liteflow Default Properties",
value = "classpath:/META-INF/liteflow-default.properties")
public class LiteflowMainAutoConfiguration {
@Bean

View File

@@ -2,15 +2,23 @@ package com.yomahub.liteflow.springboot;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* 监控器的基础参数类
* @author Bryan.Zhang
*/
@ConfigurationProperties(prefix = "liteflow.monitor", ignoreUnknownFields = true)
public class LiteflowMonitorProperty {
//是否打印监控日志
private boolean enableLog;
//监控队列存储的最大数量
private int queueLimit;
//延迟多少毫秒打印
private long delay;
//每隔多少毫秒打印
private long period;
public boolean isEnableLog() {

View File

@@ -2,14 +2,21 @@ package com.yomahub.liteflow.springboot;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* 执行流程主要的参数类
* @author Bryan.Zhang
*/
@ConfigurationProperties(prefix = "liteflow", ignoreUnknownFields = true)
public class LiteflowProperty {
//流程定义资源地址
private String ruleSource;
//slot的数量
private int slotSize;
private int whenMaxWaitSecond;
//异步线程最大等待描述
private int whenMaxWaitSeconds;
public String getRuleSource() {
return ruleSource;
@@ -27,11 +34,11 @@ public class LiteflowProperty {
this.slotSize = slotSize;
}
public int getWhenMaxWaitSecond() {
return whenMaxWaitSecond;
public int getWhenMaxWaitSeconds() {
return whenMaxWaitSeconds;
}
public void setWhenMaxWaitSecond(int whenMaxWaitSecond) {
this.whenMaxWaitSecond = whenMaxWaitSecond;
public void setWhenMaxWaitSeconds(int whenMaxWaitSeconds) {
this.whenMaxWaitSeconds = whenMaxWaitSeconds;
}
}

View File

@@ -7,6 +7,12 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
/**
* LiteflowConfig的装配类
* 这个装配类主要是把监控器的配置参数类和流程配置参数类作一个合并,转换成统一的配置参数类。
* 同时这里设置了默认的参数路径如果在springboot的application.properties/yml里没取到的话就取默认值
* @author Bryan.Zhang
*/
@Configuration
@EnableConfigurationProperties({LiteflowProperty.class,LiteflowMonitorProperty.class})
@ConditionalOnProperty(prefix = "liteflow", name = "rule-source")
@@ -20,7 +26,7 @@ public class LiteflowPropertyAutoConfiguration {
LiteflowConfig liteflowConfig = new LiteflowConfig();
liteflowConfig.setRuleSource(property.getRuleSource());
liteflowConfig.setSlotSize(property.getSlotSize());
liteflowConfig.setWhenMaxWaitSecond(property.getWhenMaxWaitSecond());
liteflowConfig.setWhenMaxWaitSeconds(property.getWhenMaxWaitSeconds());
liteflowConfig.setEnableLog(liteflowMonitorProperty.isEnableLog());
liteflowConfig.setQueueLimit(liteflowMonitorProperty.getQueueLimit());
liteflowConfig.setDelay(liteflowMonitorProperty.getDelay());