Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/v5tech/spring-boot-apollo-sample
Demo project for Spring Boot Apollo
https://github.com/v5tech/spring-boot-apollo-sample
apollo spring-boot spring-boot-apollo-sample
Last synced: 4 months ago
JSON representation
Demo project for Spring Boot Apollo
- Host: GitHub
- URL: https://github.com/v5tech/spring-boot-apollo-sample
- Owner: v5tech
- Created: 2017-07-10T09:32:14.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-12T02:57:16.000Z (over 7 years ago)
- Last Synced: 2024-10-04T13:14:48.792Z (4 months ago)
- Topics: apollo, spring-boot, spring-boot-apollo-sample
- Language: Java
- Size: 4.87 MB
- Stars: 21
- Watchers: 3
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# spring-boot-apollo-sample
Demo project for Spring Boot ApolloSpring Boot整合携程Apollo配置中心
## 客户端maven配置
* apollo-client(必须)
```xml
com.ctrip.framework.apollo
apollo-client
0.8.0```
* spring-boot-starter-actuator 和 spring-cloud-context```xml
org.springframework.boot
spring-boot-starter-actuatororg.springframework.cloud
spring-cloud-context
1.2.2.RELEASE```
注意:
1、`apollo-client`为必须配置
2、`spring-boot-starter-actuator` 和 `spring-cloud-context`为可选配置。仅在使用`Spring Cloud`的`@RefreshScope`时所需
## 客户端使用
![](Screenshots/6B4E9E4C-2744-4B76-B1BA-21343CAC0508.png)
* Java Config结合Spring Placeholder方式
详见JavaConfigSample。JavaConfigSample使用`Config API`实现属性值变动实时修改
![](Screenshots/1.gif)
* Spring Boot ConfigurationProperties方式
详见ConfigurationPropertiesSample。
ConfigurationPropertiesSample并没有使用`Config API`实现属性值变动实时修改,而是采用`Spring Cloud`的`@RefreshScope`注解和`/refresh`端点来刷新属性值
![](Screenshots/2.gif)
注:本示例代码所有配置属性在Apollo配置中心修改后立即生效。
# 参考文档
https://github.com/ctripcorp/apollo/wiki/