我有問題..我正在創建一個 aspectj 類并進入我的類我需要訪問一個 spring-boot 服務,但是當我嘗試使用 @Autowired 或通過構造函數注入它時我有一個錯誤:“無法自動裝配。找不到‘UserService’類型的 bean”這是我的課:package com.ingressolive.bar.aop.interceptor;@Aspect@Configurationpublic class TenantAspect { private final Logger log = LoggerFactory.getLogger(this.getClass()); private final Environment env; @Autowired private UserService userService; public TenantAspect(Environment env) { this.env = env; } @Before("execution(* com.ingressolive.bar.service.*.*(..))") public void aroundExecution(JoinPoint pjp) { log.debug("##################################### Entered here !!!!!!!!!!!!!!!!!!!!!!!!!!"); }}有人能幫我嗎?
如何將 Spring-boot 服務注入 aspectj 類?
慕尼黑5688855
2023-04-26 16:15:54