Aspectj @Around annotation, prevents the code called by the method itself to initialize Spring Autowireds

Viewed 51

I am using an AspectJ interceptor using the @Around annotation to measure specific execution times during Spring Unit tests.

When intercepted by Aspectj Aspect @Around annotation, the code called by the method itself use non initialized Autowired.

The class member annotated with @Value("${some.configured.property}") of at least one autowired Component is not initialized and this lead to a Null Pointer Exception.

The unit test itself works perfectly when not intercepted.

How would you configure Aspectj to let Spring initialize its Components properly before interception ?

0 Answers
Related