config.client

简介: 配置中心的客户端

    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.9.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <!-- <artifactId>spring-cloud-starter-config</artifactId> -->
        <artifactId>spring-cloud-config-client</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-eureka</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-bus-amqp</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Edgware.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

<repositories>
    <repository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>https://repo.spring.io/milestone</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>maven-repository</id>
        <url>http://repo1.maven.org/maven2/</url>
    </repository>
</repositories>

application.yml
eureka:
client:

serviceUrl:
  defaultZone: http://192.168.106.1:8762/eureka/ #10.67.31.148

info:
profile: dev-v9

bootstrap.properties
spring.application.name=config-client
spring.cloud.config.label = master
spring.cloud.config.profile = dev
spring.cloud.config.uri = http://localhost:6201/
server.port = 8002

close security when bus fresh

management.security.enabled = false

open bus trace

spring.cloud.bus.trace.enabled = true

spring.rabbitmq.host = localhost
spring.rabbitmq.port = 5672
spring.rabbitmq.username = mqadmin
spring.rabbitmq.password = 123456

@RefreshScope
@EnableDiscoveryClient
@SpringBootApplication
@RestController
public class ConfigClientApp {

public static void main(String[] args) {
    SpringApplication.run(ConfigClientApp.class, args);
}

@Value("${info.profile}")
String foo;

@RequestMapping(value = "/hi")
public String hi() {
    return foo;
}

}

相关实践学习
消息队列RocketMQ版:基础消息收发功能体验
本实验场景介绍消息队列RocketMQ版的基础消息收发功能,涵盖实例创建、Topic、Group资源创建以及消息收发体验等基础功能模块。
消息队列 MNS 入门课程
1、消息队列MNS简介 本节课介绍消息队列的MNS的基础概念 2、消息队列MNS特性 本节课介绍消息队列的MNS的主要特性 3、MNS的最佳实践及场景应用 本节课介绍消息队列的MNS的最佳实践及场景应用案例 4、手把手系列:消息队列MNS实操讲 本节课介绍消息队列的MNS的实际操作演示 5、动手实验:基于MNS,0基础轻松构建 Web Client 本节课带您一起基于MNS,0基础轻松构建 Web Client
目录
相关文章
|
监控 Dubbo 搜索推荐
No application config found or it‘s not a valid config! Please add <dubbo:application name=“...“ />
No application config found or it‘s not a valid config! Please add <dubbo:application name=“...“ />
1314 1
|
存储 Kubernetes 数据安全/隐私保护
K8S | Config应用配置
不论是应用还是运行层面的配置,都会涉及到一个基本的逻辑:配置可以抽取出来单独管理,在流程中直接引入该配置即可;
221 0
|
NoSQL Java Redis
SpringBoot项目连接Redis:ERR Client sent AUTH, but no password is set
SpringBoot项目连接Redis:ERR Client sent AUTH, but no password is set
597 0
SpringBoot项目连接Redis:ERR Client sent AUTH, but no password is set
成功解决Not possible to connect to the Web3 provider. Make sure the provider is running and a connection
成功解决Not possible to connect to the Web3 provider. Make sure the provider is running and a connection
|
NoSQL API Redis
|
Spring Java 安全
config.server
<groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.
1281 0
|
内存技术 iOS开发
|
JavaScript 前端开发
|
XML 网络协议 JavaScript