SpringBoot: 2.5.5 SpringCloud: 2020.0.4
Describe the bug I'm getting an error when the /actuator/busrefresh endpoint of the config server is called:
config-app | 2021-10-21 07:34:53.787 INFO 1 --- [nio-8012-exec-1] o.s.cloud.bus.event.RefreshListener : Received remote refresh request.
config-app | 2021-10-21 07:34:53.958 INFO 1 --- [nio-8012-exec-1] onfigDataMissingEnvironmentPostProcessor : Error binding spring.config.import
config-app |
config-app | java.lang.NullPointerException: null
config-app | at org.springframework.boot.context.properties.bind.Binder.findProperty(Binder.java:444) [spring-boot-2.5.5.jar!/:2.5.5]
...
config-app |
config-app | 2021-10-21 07:34:53.984 ERROR 1 --- [nio-8012-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.cloud.commons.ConfigDataMissingEnvironmentPostProcessor$ImportException: No spring.config.import set] with root cause
config-app |
config-app | org.springframework.cloud.commons.ConfigDataMissingEnvironmentPostProcessor$ImportException: No spring.config.import set
config-app | at org.springframework.cloud.commons.ConfigDataMissingEnvironmentPostProcessor.postProcessEnvironment(ConfigDataMissingEnvironmentPostProcessor.java:79) ~[spring-cloud-commons-3.0.4.jar!/:3.0.4]
config-app | at org.springframework.cloud.context.refresh.ConfigDataContextRefresher.updateEnvironment(ConfigDataContextRefresher.java:92) ~[spring-cloud-context-3.0.4.jar!/:3.0.4]
I don't expect this to happen on config-server since I don't have spring-cloud-starter-config in dependencies.
Sample https://github.com/schabluk/config-server
To reproduce:
git clone https://github.com/schabluk/config-server
cd config-server/app && mvn clean package
cd .. && docker-compose up --build
The server should start without errors and register to Kafka.
A GET request to config-server
endpoint should return values from the file backend:
$ curl -X GET http://localhost:8012/config-server/default
{"name":"config-server","profiles":["default"],"label":null,"version":null,"state":null,"propertySources":[{"name":"file:/usr/app/config-backend/application.properties","source":{"gateway.ip":"10.5.0.55"}}]}
A POST request to busrefresh
endpoint should fail with an error message in docker logs:
$ curl -X POST http://localhost:8012/actuator/busrefresh
{"timestamp":"2021-10-20T19:39:45.622+00:00","status":500,"error":"Internal Server Error","path":"/actuator/busrefresh"}
To clean up containers run:
docker-compose down -v
Comment From: ryanjbaxter
Duplicate of https://github.com/spring-cloud/spring-cloud-config/issues/1983