Spring 配置服务器提供纯文本

Spring Config server serving plain text

我正在尝试重现 http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_serving_plain_text 服务于 logback.xml 文件。

当我尝试 curl -v http://localhost:8888/gateway/default/master/logback.xml 我得到了一个:

Hostname was NOT found in DNS cache

Trying 127.0.0.1...

Connected to localhost (127.0.0.1) port 8888 (#0)

GET /gateway/default/master/logback.xml HTTP/1.1

User-Agent: curl/7.35.0

Host: localhost:8888

Accept: /

HTTP/1.1 406 Not Acceptable

Server Apache-Coyote/1.1 is not blacklisted

Server: Apache-Coyote/1.1

X-Application-Context: configserver:8888

Content-Type: application/json;charset=UTF-8

Transfer-Encoding: chunked

Date: Thu, 17 Mar 2016 17:26:02 GMT

Connection #0 to host localhost left intact

{"timestamp":1458235562683,"status":406,"error":"Not Acceptable","exception":"org.springframework.web.HttpMediaTypeNotAcceptableException","message":"Could not find acceptable representation","path":"/gateway/default/master/logback.xml"}%

我正在使用 Brixton.M5,这是存储库结构:

 - application.yml
 - gateway.yml
 - auth.yml
 - eureka.yml
 - logback.xml
 - test.json

curl -v http://localhost:8888/gateway/default/master/test.json正常工作。

您需要使用 Brixton.BUILD-SNAPSHOT(RC1 将在今天晚些时候或明天发布)。

我是用 http://github.com/spring-cloud-samples/config-repo/tree/master with http://localhost:8888/gateway/default/master/test.json and http://localhost:8888/gateway/default/master/books.xml 做的,效果不错。