我是微服务的新手。我正在尝试创建一个用于学习目的的小型应用程序。这是我的代码:EurekaServer - application.yml
spring:
application:
name: EurekaServer
server:
port: 8080
servlet:
context-path: /EurekaServer
eureka:
client:
fetch-registry: false
register-with-eureka: false
Run Code Online (Sandbox Code Playgroud)
Eureka Server 工作正常,我可以在http://localhost:8080/EurekaServer看到仪表板
EmployeeClient:application.yml 如下:
spring:
application:
name: EmployeeClient
server:
port: 8586
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8080/EurekaServer
Run Code Online (Sandbox Code Playgroud)
在最后一行中,我需要像在 sts 中按 ctrl+space 一样显式地编写 serviceUrl 它不显示选项 serviceUrl 但它显示 service-url、连字符符号。与 defaultZone 相同。我是否缺少一些 jar 或特定版本?
我的 EmployeeClientApplication.java
@EnableEurekaClient
@SpringBootApplication
public class EmployeeClientApplication {
public static void main(String[] args) {
SpringApplication.run(EmployeeClientApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
当我尝试运行 EmployeeClientApplication.java 时,它给了我以下异常:
com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known …Run Code Online (Sandbox Code Playgroud)