Update AdminConfig.java

cyj
pbvfus8to 8 months ago
parent 58d385bd3a
commit ffea9fd8bb

@ -1,5 +1,8 @@
```java
/*
* Copyright (c) 2018-2999 广 All rights reserved.
* Copyright (c) 2018 - 2999 广 All rights reserved.
*
* https://www.mall4j.com/
*
@ -16,35 +19,43 @@ import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
* AdminConfig
* Spring便使
* AdminConfig
* Spring便使
*
* @author lgh
*/
@Component
// @Component注解将该类标记为Spring组件意味着Spring容器在扫描时会识别这个类并将其纳入管理范围
// 这样就可以在其他需要使用该配置信息的地方通过依赖注入的方式获取到这个类的实例。
/**
* @ComponentSpringSpring
* 使
*/
@PropertySource("classpath:admin.properties")
// @PropertySource注解用于指定配置属性的来源这里明确表示配置信息将从类路径下的admin.properties文件中获取。
/**
* @PropertySourceadmin.properties
*/
@ConfigurationProperties(prefix = "admin")
// @ConfigurationProperties注解的作用是把配置文件中以"admin"为前缀的属性绑定到这个类对应的成员变量上,实现配置属性的自动注入。
/**
* @ConfigurationProperties"admin"
*/
@Data
// @Data是Lombok提供的注解它会自动为类生成一系列常用的方法包括各个成员变量的Getter和Setter方法、
// toString方法、equals方法以及hashCode方法等方便对类中的成员变量进行操作和访问。
/**
* @DataLombokGetterSetter
* toStringequalshashCode便访
*/
public class AdminConfig {
/**
* ID
* ID
* ID使Snowflake
* ID
* ID
*/
private Integer datacenterId;
/**
* ID
* ID
* ID
* ID
* ID
*/
private Integer workerId;
}
}
```
Loading…
Cancel
Save