Spring-cloud-config: Spring Cloud Config Server breaks Swagger-UI

Created on 27 Jul 2017  路  4Comments  路  Source: spring-cloud/spring-cloud-config

We have a REST-project including Swagger 2.6.1.
After Adding @EnableConfigServer and configuring necessary properties in application.yml the config server is working.
However since then, the swagger-ui is no longer working.
Network console of the browser prints 404 status code like this:
`"NetworkError: 500 - http://localhost:8093/webjars/springfox-swagger-ui/images/logo_small.png"
logo_small.png
"NetworkError: 500 - http://localhost:8093/webjars/springfox-swagger-ui/lib/object-assign-pollyfill.js"
object-...fill.js
"NetworkError: 500 - http://localhost:8093/webjars/springfox-swagger-ui/lib/jquery-1.8.0.min.js"

Seems to be caused by Swagger's Javascript that executes queries which are interpreted from config server as config queries.

Is there a possibility to let the config server run on a specific context to prevent this collision?

All 4 comments

We intend the config server to really be run as a standalone app with its sole purpose to be serving configuration data. Having it also server other purposes is not something we generally suggest doing.

OK, in the meantime I created a dedicated config server.

Yes I also tried to add swagger for exposing the refresh and health endpoints of the actuator, but the swagger Ui doesnt work with the spring cloud config server with the error

15:09:45.431 INFO   DispatcherServlet.initServletBean:547 - Completed initialization in 4 ms

15:10:03.432 WARN ExceptionHandlerExceptionResolver.logException:199 - Resolved [org.springframework.cloud.config.server.environment.NoSuchLabelException: No such label: swagger-ui-standalone-preset.js]
15:10:06.028 WARN ExceptionHandlerExceptionResolver.logException:199 - Resolved [org.springframework.cloud.config.server.environment.NoSuchLabelException: No such label: springfox.css]
15:10:11.030 WARN ExceptionHandlerExceptionResolver.logException:199 - Resolved [org.springframework.cloud.config.server.environment.NoSuchLabelException: No such label: swagger-ui.css]
15:10:13.574 WARN ExceptionHandlerExceptionResolver.logException:199 - Resolved [org.springframework.cloud.config.server.environment.NoSuchLabelException: No such label: swagger-ui-bundle.js]
15:10:16.133 WARN ExceptionHandlerExceptionResolver.logException:199 - Resolved [org.springframework.cloud.config.server.environment.NoSuchLabelException: No such label: springfox.js]
15:10:18.692 WARN ExceptionHandlerExceptionResolver.logException:199 - Resolved [org.springframework.cloud.config.server.environment.NoSuchLabelException: No such label: swagger-ui-standalone-preset.js]
15:10:21.259 WARN ExceptionHandlerExceptionResolver.logException:199 - Resolved [org.springframework.cloud.config.server.environment.NoSuchLabelException: No such label: springfox.js]

I used the configuration property: spring.cloud.config.server.prefix in the bootstrap.properties file to configure the cloud config server on a non conflicting path.

Was this page helpful?
0 / 5 - 0 ratings