首页 > 解决方案 > Spring Cloud 配置服务器发送 Spring Security 登录表单而不是 logback.xml

问题描述

我正在使用 spring 云配置服务器来存储logback.xml配置。这是我使用的微服务(即 spring 云配置客户端)bootstrap.properties文件:

server.port=5555
spring.application.name=test-ms
spring.profiles.active=development
spring.cloud.config.uri=http://localhost:8888
spring.cloud.config.username=root
spring.cloud.config.password=123123
logging.config=http://localhost:8888/test-ms/development/master/logback.xml

这一直很好,直到我在我的 spring 云配置服务器上打开 spring security。之后它发送弹簧安全登录表单而不是logback.xml所以我得到一个异常:

Logging system failed to initialize using configuration from 'http://localhost:8888/test-ms/development/master/logback.xml'
java.lang.IllegalStateException: Could not initialize Logback logging from http://localhost:8888/test-ms/development/master/logback.xml

...

Caused by: org.xml.sax.SAXParseException; systemId: http://localhost:8888/test-ms/development/master/logback.xml; lineNumber: 11; columnNumber: 5; The element type "link" must be terminated by the matching end-tag "</link>".

因为正如我所说,它正在获取 spring 安全登录页面而不是logback.xml. 但我需要在我的 spring 云配置服务器上进行身份验证。我尝试将用户名和密码放入 url:logging.config=http://user:passwordlocalhost:8888/test-ms/development/master/logback.xml但它没有帮助。如何将我的 Spring Cloud 配置客户端指向 Spring Cloud 配置服务器上的 xml?

标签: javaspringspring-bootspring-cloud-config

解决方案


推荐阅读