nacos的服务列表中找不到启动的服务该如何处理?

143 阅读1分钟

当前服务必须是web容器才能触发服务注册,原因如下:

类org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration实现了ApplicationListener方法,只有web容器才能触发执行onApplicationEvent方法

解决方案:

让当前服务变为web容器

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>