Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Afeiamic
SpringCloud
提交
6b70aee6
SpringCloud
项目概览
Afeiamic
/
SpringCloud
通知
3
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
分析
仓库
DevOps
项目成员
Pages
SpringCloud
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
6b70aee6
编写于
1月 28, 2023
作者:
W
wangfeihu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Apollo配置中心简单使用
上级
6c5614a2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
110 addition
and
0 deletion
+110
-0
cloud-config-apollo-client3399/pom.xml
cloud-config-apollo-client3399/pom.xml
+52
-0
cloud-config-apollo-client3399/src/main/java/com/afeiamic/springcloud/ApolloConfigMain3399.java
...n/java/com/afeiamic/springcloud/ApolloConfigMain3399.java
+14
-0
cloud-config-apollo-client3399/src/main/java/com/afeiamic/springcloud/controller/ApolloConfigController.java
...eiamic/springcloud/controller/ApolloConfigController.java
+20
-0
cloud-config-apollo-client3399/src/main/resources/application.yml
...nfig-apollo-client3399/src/main/resources/application.yml
+23
-0
pom.xml
pom.xml
+1
-0
未找到文件。
cloud-config-apollo-client3399/pom.xml
0 → 100644
浏览文件 @
6b70aee6
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
SpringCloud
</artifactId>
<groupId>
com.afeiamic.springcloud
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
cloud-config-apollo-client3399
</artifactId>
<dependencies>
<!-- 携程的 Apollo -->
<dependency>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo-client
</artifactId>
<version>
1.7.0
</version>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
<version>
2.1.2.RELEASE
</version>
</dependency>
<!-- Spring 整合 Web 组件 -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional><!– 防止将devtools依赖传递到其他模块中 –>
</dependency>-->
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
cloud-config-apollo-client3399/src/main/java/com/afeiamic/springcloud/ApolloConfigMain3399.java
0 → 100644
浏览文件 @
6b70aee6
package
com.afeiamic.springcloud
;
import
com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
@EnableApolloConfig
// 开启apollo客户端
public
class
ApolloConfigMain3399
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
ApolloConfigMain3399
.
class
,
args
);
}
}
cloud-config-apollo-client3399/src/main/java/com/afeiamic/springcloud/controller/ApolloConfigController.java
0 → 100644
浏览文件 @
6b70aee6
package
com.afeiamic.springcloud.controller
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@Slf4j
public
class
ApolloConfigController
{
@Value
(
"${config.info}"
)
private
String
configInfo
;
@RequestMapping
(
"/configInfo"
)
public
String
apollo
()
{
log
.
info
(
"apolloConfig.apolloKey=======> {}"
,
configInfo
);
return
configInfo
;
}
}
cloud-config-apollo-client3399/src/main/resources/application.yml
0 → 100644
浏览文件 @
6b70aee6
server
:
port
:
3399
app
:
id
:
cloud-config-apollo-client
apollo
:
meta
:
http://127.0.0.1:8080
bootstrap
:
enabled
:
true
eagerLoad
:
enabled
:
true
#这里说明在将该项目 com目录下的日志,都采用info模式输出
logging
:
level
:
com
:
info
eureka
:
client
:
register-with-eureka
:
true
fetch-registry
:
true
service-url
:
defaultZone
:
http://eureka7001.com:7001/eureka/,http://eureka7002.com:7002/eureka/
pom.xml
浏览文件 @
6b70aee6
...
...
@@ -36,6 +36,7 @@
<module>
cloudalibaba-provider-payment9001
</module>
<module>
cloudalibaba-consumer-nacos-order83
</module>
<module>
cloudalibaba-config-nacos-client3377
</module>
<module>
cloud-config-apollo-client3399
</module>
</modules>
<!-- 统一管理jar包版本 -->
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录