config client踩坑记录--- Could not resolve placeholder* in value *

config client踩坑记录— Could not resolve placeholder* in value *

1.准备环境

​ eureka server: 注册中心

​ config server: 配置中心

​ config client: 配置客户端

2、开始踩坑

eureka server搭建不用说,很简单,引入netflix-eureka-server依赖就行了,然后配置注册中心,主程序加入注解就ok!

pom.xml

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-server</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>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

applicaiton.properties:

server.port= 8761
spring.application.name= eureka-server
eureka.client.service-url.default-zone = http://localhost:8761/eureka/
eureka.client.registry-fetch-interval-seconds=5000
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false

applcation主程序:

package top.juntech.springcloudeurekaserver;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

@SpringBootApplication
@EnableEurekaServer
public class SpringcloudEurekaServerApplication {
   
   

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

}

ok,eurekaserver就搭建好了,接下来我们搭建配置中心config-server

新建module ---->config-server—>引入config server依赖-------->配置文件-------》主程序加入注解

1、pom.xml

<properties>
        <java.version>1.8</java.version>
        
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值