求助一个关于spring cloud config端口设置问题

在学习spring cloud时候,server端创建的时候由于8888端口已经发布其他应用了,所以就使用了8085,发布后可以正常访问,读取git仓库也没问题。然后创建client端的时候,在properties中配置spring.cloud.config.uri=http://localhost:8085/ 后启动工程,调用的还是默认的8888端口。不知道为什么spring.cloud.config.uri配置不生效,还是说只能使用8888端口,看了很多教程,大家都直接用8888。
 
server端的配置:
spring.application.name=config-server
server.port=8085
spring.cloud.config.server.git.uri=https://github.com/forezp/SpringcloudConfig/
spring.cloud.config.server.git.searchPaths=respo
spring.cloud.config.label=master
server端启动后访问http://localhost:8085/foo/dev
{
"name": "foo",
"profiles": [
"dev"],
"label": null,
"version": "a68876a6211369bae723348d5f8c3defe4a55e04",
"state": null,
"propertySources": []} 
client端的配置:
spring.application.name=config-test
server.port=8086

spring.cloud.config.uri=http://localhost:8085/
spring.cloud.config.label=master
spring.cloud.config.profile=dev
client启动报错:
 2017-09-05 15:48:49.697  INFO 21428 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8888
2017-09-05 15:48:49.790  WARN 21428 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: 400 Bad Request
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configtestApplication': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'foo' in value "${foo}"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:372) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at or
已邀请:

Levin丶挽歌 - 胆小认生,不易相处

赞同来自: wenjq

配置不能写在application.yml中必须 写在bootstrap.yml

要回复问题请先登录注册