First Commit
This commit is contained in:
53
src/main/java/quant/rich/emoney/interfaces/ConfigInfo.java
Normal file
53
src/main/java/quant/rich/emoney/interfaces/ConfigInfo.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package quant.rich.emoney.interfaces;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 将该注解用在配置上,给后台 ConfigController 自动渲染配置页用
|
||||
*
|
||||
* @author Doghole
|
||||
*
|
||||
*/
|
||||
@Bean
|
||||
@Lazy(false)
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ConfigInfo {
|
||||
/**
|
||||
* @return 配置 field 标识,用以自动注入、持久化配置文件名
|
||||
*/
|
||||
String field() default "";
|
||||
|
||||
/**
|
||||
* @return 名称
|
||||
*/
|
||||
String name() default "配置";
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 为 true 时,最终会调用其无参构造方法,若需要填充默认值的,请在无参构造器中填充。
|
||||
* 当为 true 且无法载入配置文件而触发初始化时,若存在 ./conf/system/{field}.fallback.json 文件时,从 fallback
|
||||
* 文件中初始化。fallback 仅参与初始化,不参与持久化
|
||||
* </p>
|
||||
*
|
||||
* @return 是否初始化默认值
|
||||
*/
|
||||
boolean initDefault() default false;
|
||||
|
||||
/**
|
||||
* @return 是否提供后台控制
|
||||
*/
|
||||
boolean managed() default true;
|
||||
|
||||
/**
|
||||
* 是否持久化
|
||||
*/
|
||||
boolean save() default true;
|
||||
}
|
||||
Reference in New Issue
Block a user