My aspect class is calling the aspect while startup.
but after calling the api mentioned below the model setter methods are not handled through aspect
@RestController
@AllArgsConstructor
@Slf4j
public class MyController {
@PostMapping("/terms")
public Mono<ResponseEntity<ModelResponse>> createCountryExceptionRule(@RequestBody ModelRequest model) {
model.setField1("test");
//some statements
}
}
@Data
class ModelRequest{
String field1;
String field2;
}
@Aspect
@Component
class MyAspect {
@Before("execution(public * *.set*(..))")
public void test(JoinPoint joinPoint) {
System.out.println("Before method:" + joinPoint.getSignature());
}
}
@SpringBootApplication
@EnableAspectJAutoProxy(proxyTargetClass=true)
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
}
dependency i have added is below
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
The aspect is not getting called if I'm calling the api through http request
what's wrong am I doing here or anything I'm missing?