1.版本问题
项目启动时报错
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server........
由于springboot和springcloud版本不兼容导致
可以降低springboot的版本,也可以提高springcloud的版本
我原本用的Spring-Cloud版本
Greenwich.SR3
报错后更换为
Hoxton.SR1
然后正常运行
2.Eureka-server配置
server:
port: 7001
eureka:
instance:
hostname: localhost #服务注册中心实例的主机名
client:
register-with-eureka: false #是否在eureka服务器上注册自己的信息以供其他服务发现,默认为true
fetch-registry: false #此客户端是否获取eureka服务器注册表上的注册信息,默认为true
service-url: #与注册中心通信地址
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
然后通过localhost:端口号 访问注册中心页面
3.Eureka-client配置
spring:
application:
name: springcloud-provider-dept #注册到eu