dyc87112 / blog-comments

5 stars 1 forks source link

Spring Cloud构建微服务架构:分布式配置中心【Dalston版】 | 程序猿DD #180

Open dyc87112 opened 6 years ago

dyc87112 commented 6 years ago

http://blog.didispace.com/spring-cloud-starter-dalston-3/

Spring Cloud Config是Spring Cloud团队创建的一个全新项目,用来为分布式系统中的基础设施和微服务应用提供集中化的外部配置支持,它分为服务端与客户端两个部分。其中服务端也称为分布式配置中心,它是一个独立的微服务应用,用来连接配置仓库并为客户端提供获取配置信息、加密/解密信息等访问接口;而客户端

enjoyCoding666 commented 6 years ago

config服务端可以访问,成功返回数据。。但是config客户端访问一直是404。。

ychost commented 6 years ago

注意是 bootstrap.yml 不是 application.yml

derekng622 commented 6 years ago

DD老大,请问client配置了通过config server抓取配置文件,运行时是否能使用命令行设置server.port为其他值?比如:

java -jar target\client-demo-1.0.0.BUILD-SNAPSHOT.jar --spring.profiles.active=test --server.port=9999

貌似还是使用了test里面的端口号。

ghost commented 5 years ago

为什么我直接访问/info ,404呢? 使用@value 能获取到 info.profile 属性... ...

mj8star commented 5 years ago

DD大佬,config-client端访问总是404,什么原因

zhangxianseng commented 5 years ago

按照步骤来的,访问info出现404,怎么回事呀

dyc87112 commented 5 years ago

@zhangxianseng 按照步骤来的,访问info出现404,怎么回事呀

是不是用的spring boot 2.0?是的,actuator下的端点都默认为:/actuator开头了噢,比如/info变为/actuator/info

zhangxianseng commented 5 years ago

@zhangxianseng 按照步骤来的,访问info出现404,怎么回事呀

是不是用的spring boot 2.0?是的,actuator下的端点都默认为:/actuator开头了噢,比如/info变为/actuator/info

可以了,3Q

zhangqi1214 commented 5 years ago

config 启动都启动不了,也没有报错

chaselwin commented 5 years ago

@RestController public class InfoController {

@Value("${info.profile}")
String info;
@RequestMapping(value = "/info")
public String info(){
    return info;
}

}

注入访问可以

xwj-vic commented 5 years ago

clinet访问结果是{},是因为没有去call server,为什么会这样?求解决

guoquan676 commented 5 years ago

@licer-lee DD大佬,config-client端访问总是404,什么原因

同问

guoquan676 commented 5 years ago

你在 后面高可用与动态刷新可以看到 这里的404 得到解决了

PlayerYao commented 5 years ago

好像现在client端要导这个依赖

org.springframework.boot spring-boot-starter-actuator

然后访问路径是:http://localhost:2001/actuator/info

zhyblack commented 5 years ago

少了一个依赖,路径没错,

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Bingoch commented 4 years ago

404 的可能原因: 1.少了依赖spring-boot-starter-actuator
2.springboot2.0版本/info变为/actuator/info