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>


333

被折叠的 条评论
为什么被折叠?



