I'm with a problem.. I'm creating a aspectj class and into my class I need to access a spring-boot service, but when I try use @Autowired or inject it through a constructor I have an error:
"Could not autowire. No beans of 'UserService' type found"
Here my class:
package com.ingressolive.bar.aop.interceptor;
@Aspect
@Configuration
public 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 !!!!!!!!!!!!!!!!!!!!!!!!!!");
}
}
Can someone help me?