
F12可以看到静态资源路径全部都是加载失败。这是因为我们没有对静态文件进行路由导致。
配置文件方式
贴出主要配置:/static/**表示对静态资源的路由
routes:
- id: home-service
uri: lb://home-service #lb表示从注册中心找到服务
predicates: #路由规则
- Path=/home-service/**, /static/**
- id: user-service
uri: lb://user-service
predicates:
- Path=/user-service/**, /static/**
对应服务配置文件
spring:
resources:
static-locations: 静态资源路径