From 797379b485b63cf08cfe3be270f2c89182c89638 Mon Sep 17 00:00:00 2001 From: "zhantiao@tiduyun.com" Date: Mon, 14 Aug 2023 11:17:15 +0800 Subject: [PATCH] [ISSUE #10951]Autowired members must be defined in valid Spring bean (#10951) --- .../server/aspect/CapacityManagementAspect.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/config/src/main/java/com/alibaba/nacos/config/server/aspect/CapacityManagementAspect.java b/config/src/main/java/com/alibaba/nacos/config/server/aspect/CapacityManagementAspect.java index 8159d373782..716f84fe64c 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/aspect/CapacityManagementAspect.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/aspect/CapacityManagementAspect.java @@ -28,7 +28,6 @@ import org.aspectj.lang.annotation.Aspect; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -55,11 +54,14 @@ public class CapacityManagementAspect { "execution(* com.alibaba.nacos.config.server.controller.ConfigController.deleteConfig(..)) && args" + "(request,response,dataId,group,tenant,..)"; - @Autowired - private CapacityService capacityService; - - @Autowired - private ConfigInfoPersistService configInfoPersistService; + private final CapacityService capacityService; + + private final ConfigInfoPersistService configInfoPersistService; + + public CapacityManagementAspect(ConfigInfoPersistService configInfoPersistService, CapacityService capacityService) { + this.configInfoPersistService = configInfoPersistService; + this.capacityService = capacityService; + } /** * Need to judge the size of content whether to exceed the limitation.