大家好,我有以下问题,我尝试将 zuul 添加到我的项目中 我有尤里卡:
Zuul yml 属性文件
server:
port: 5555
eureka:
instance:
prefer-ip-address: true
client:
register-with-eureka: true
fetch-registry: true
service-url:
default-zone: http://localhost:8761/eureka
ribbon:
eureka:
enabled: false
尤里卡 yml 属性文件
server:
port: 8761
eureka:
client:
register-with-eureka: false
fetch-registry: false
server:
wait-time-in-ms-when-sync-empty: 5
服务 yml 属性文件
spring:
jpa:
hibernate:
ddl-auto: update
show-sql: "true"
database: mysql
properties:
hibernate:
dialect: "org.hibernate.dialect.MySQL5Dialect"
datasource:
url: "jdbc:mysql://localhost:3306/itemsharingdatabase?createDatabaseIfNotExist=true"
username: "root"
password: "{cipher}fb9c82e47704ebea5965914e06b2649938f0dd2c13a9dfeb4e44fde1e53bdda7"
dbcp2:
test-while-idle: true
validation-query: "SELECT 1"
server:
port: 8082
eureka:
instance:
prefer-ip-address: true
client:
register-with-eureka: true
fetch-registry: true
service-url:
default-zone: http://localhost:8761/eureka/
logging:
level:
com.netflix: WARN
org.springframework.web: WARN
com.itemsharing: DEBUG
服务名称在 bootstrap.yml 中,因为这个属性文件在配置远程仓库中。 我添加到服务@EnableEurekaClient
Zuul Main 也有 @EnableZuulProxy 和 @EnableEurekaClient
需要帮助的人。