I have a simple counter
@Aspect
@Component
public class Countter {
@After("@annotation(com.example.MessageAnnotation)")
public void increment(JoinPoint point){
//do increment
}
}
And I have messages listener
@Component
@AllArgsConstructor
@FieldsDefaults(level=Private, makeFinal = true)
public class Handler {
@NotNull UserRepository repo;
@NotNull MessageClient client;
@MessageAnnotation // <- here annotation works, an I can pass to increment method!!!
public void handleEvent(Event event) {
User user = repo.fondById(event.getId);
user.ifPresent(o - > send(o))
}
@MessageAnnotation // <- I need to pass to increment method from this method because the user sometimes is
public void send(User user) { // not present, but it doesn't work.
//do send user
}
}
What is my problem? Why I cant pass to increment method from method from another method?