When I use Spring Boot Test, I start the unit test and the console prompts that the service is started normally, but there is no corresponding service instance in consul. However, when I start it through Application, the service can be registered in consul normally.

Is there anyone who can help me?

Comment From: conifercone

springboot version:3.3.6 springcloud verison:2023.0.3

Comment From: conifercone

I found through the log that ConsulServiceRegistry and UndertowWebServer were not triggered in the unit test, resulting in no service instance on consul during the unit test. Is there any way for me to register the service to consul during the unit test? Because I need to test the grpc function, I have a grpc service discovery function implementation that needs to use discoveryClient.

Comment From: conifercone

I have solved