【发布时间】:2019-04-09 19:05:07
【问题描述】:
我注意到很多人问了同样的问题,但是我尝试了他们的方法,但我的问题仍然存在。
我用的是spring-boot + eureka + zuul,
spring.cloud.version: 2.0.2.RELEASE
这里是 Eureka 服务器:
@SpringBootApplication
@EnableEurekaServer
@Slf4j
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
log.info("-- EurekaServerApplication started --");
}
}
以及 eureka 服务器的 application.yml:
server:
port: 8888
eureka:
client:
registerWithEureka: false
fetchRegistry: false
healthcheck:
enabled: true
service-url:
defaultZone: http://localhost:8888/eureka
那么这里是Zuul服务器:
@SpringBootApplication
@EnableZuulProxy
@EnableEurekaClient
@Slf4j
public class ZuulServerApplication{
public static void main(String[] args) {
SpringApplication.run(ZuulServerApplication.class, args);
log.info("-- ZuulServerApplication started --");
}
}
以及 Zuul 的 application.yml
server:
port: 7777
eureka:
instance:
appname: zuul-server
client:
serviceUrl:
defaultZone: http://localhost:8888/eureka
zuul:
ignoredServices: '*'
routes:
file-management:
path: /file-management/**
serviceId: file-management
还有一个微服务文件管理:
@SpringBootApplication
@EnableEurekaClient
@EnableSwagger2
@Slf4j
public class FileManagementApplication {
public static void main(String[] args) {
SpringApplication.run(FileManagementApplication.class, args);
log.info("-- FileManagement started --");
}
}
application.yml
... some other configs
server:
port: 8081
eureka:
instance:
appname: file-management
client:
serviceUrl:
defaultZone: http://localhost:8888/eureka
我这几天有这个问题,任何帮助将不胜感激!
【问题讨论】:
标签: configuration microservices spring-cloud netflix-eureka netflix-zuul