增加sczx_car服务的路由映射,增加请求响应的日志

This commit is contained in:
2025-07-12 22:28:33 +08:00
parent 2fa4709f6d
commit 6275cab4eb
6 changed files with 211 additions and 1 deletions

View File

@ -1,11 +1,13 @@
package com.sczx.gateway.component;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.event.RefreshRoutesEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class DynamicRouteScheduler {
@ -15,6 +17,7 @@ public class DynamicRouteScheduler {
// 每30秒刷新一次路由可按需调整
@Scheduled(fixedRate = 30_000)
public void refreshRoutes() {
log.info("refreshRoutes");
publisher.publishEvent(new RefreshRoutesEvent(this));
}
}