侧边栏壁纸
  • 累计撰写 116 篇文章
  • 累计创建 1 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

springboot自定义yml配置(配合lombak使用)

application.yml

application:
 admin:
   allow-delete: enabled
   allow-register: enabled

AdminConfig.java

/**
 * 管理员相关配置
 *
 * @author xclhove
 */
@Component
@ConfigurationProperties(prefix = "cheetah.admin")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AdminConfig {
    private AllowRegister allowRegister;
    private AllowDelete allowDelete;
}

AllowDelete

/**
 * 是否开启删除管理员功能
 *
 * @author xclhove
 */
@Getter
@AllArgsConstructor
public enum AllowDelete {
    ENABLED(true, "允许删除管理员"),
    DISABLED(false, "不允许删除管理员");
    private final boolean value;
    private final String description;
}

AllowRegister

/**
 * 是否开启管理员注册功能
 *
 * @author xclhove
 */
@Getter
@AllArgsConstructor
public enum AllowRegister {
    ENABLED(true, "允许管理员注册"),
    DISABLED(false, "不允许管理员注册");
    private final boolean value;
    private final String description;
}
博主关闭了所有页面的评论