nacos服务注册
This commit is contained in:
@@ -111,6 +111,11 @@
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
<!-- 服务注册发现 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -30,7 +30,7 @@ public class AlarmConfig {
|
||||
// 根据配置文件中的告警类型,初始化选择不同的告警实现类
|
||||
if (StringUtils.equals(XiaoyiAuthConstants.ALARM_TYPE_SMS, alarmType)) {
|
||||
return new SmsAlarmHelper();
|
||||
} else if (StringUtils.equals(XiaoyiAuthConstants.ALARM_TYPE_MAIL, alarmType)) {
|
||||
} else if (StringUtils.equals(XiaoyiAuthConstants.ALARM_TYPE_EMAIL, alarmType)) {
|
||||
return new MailAlarmHelper();
|
||||
} else {
|
||||
throw new IllegalArgumentException("错误的告警类型...");
|
||||
|
||||
+1
-1
@@ -13,5 +13,5 @@ public class XiaoyiAuthConstants {
|
||||
public static final Long XIAOYI_ID_INITIAL_VALUE = 1000000L;
|
||||
|
||||
public static final String ALARM_TYPE_SMS = "sms";
|
||||
public static final String ALARM_TYPE_MAIL = "mail";
|
||||
public static final String ALARM_TYPE_EMAIL = "email";
|
||||
}
|
||||
|
||||
@@ -9,6 +9,11 @@ spring:
|
||||
server-addr: http://127.0.0.1:8848 # 指定 Nacos 配置中心的服务器地址
|
||||
prefix: ${spring.application.name} # 配置 Data Id 前缀,这里使用应用名称作为前缀
|
||||
group: DEFAULT_GROUP # 所属组
|
||||
namespace: public # 命名空间
|
||||
namespace: xiaoyishu # 命名空间
|
||||
file-extension: yaml # 配置文件格式
|
||||
refresh-enabled: true # 是否开启动态刷新
|
||||
discovery:
|
||||
enabled: true # 启用服务发现
|
||||
group: DEFAULT_GROUP # 所属组
|
||||
namespace: xiaoyishu # 命名空间
|
||||
server-addr: 127.0.0.1:8848 # 指定 Nacos 配置中心的服务器地址
|
||||
|
||||
Reference in New Issue
Block a user