Git Product home page Git Product logo

spring-boot-apollo-sample's Introduction

spring-boot-apollo-sample

Demo project for Spring Boot Apollo

Spring Boot整合携程Apollo配置中心

客户端maven配置

  • apollo-client(必须)
<dependency>
    <groupId>com.ctrip.framework.apollo</groupId>
    <artifactId>apollo-client</artifactId>
    <version>0.8.0</version>
</dependency>
  • spring-boot-starter-actuator 和 spring-cloud-context
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-context</artifactId>
    <version>1.2.2.RELEASE</version>
</dependency>

注意:

1、apollo-client为必须配置

2、spring-boot-starter-actuatorspring-cloud-context为可选配置。仅在使用Spring Cloud@RefreshScope时所需

客户端使用

  • Java Config结合Spring Placeholder方式

详见JavaConfigSample。JavaConfigSample使用Config API实现属性值变动实时修改

  • Spring Boot ConfigurationProperties方式

详见ConfigurationPropertiesSample。

ConfigurationPropertiesSample并没有使用Config API实现属性值变动实时修改,而是采用Spring Cloud@RefreshScope注解和/refresh端点来刷新属性值

注:本示例代码所有配置属性在Apollo配置中心修改后立即生效。

参考文档

https://github.com/ctripcorp/apollo/wiki/

spring-boot-apollo-sample's People

Contributors

ameizi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.