As mentioned by Bond, these are Java EE annotations, not Spring ones - however as with many annotations, Spring supports them (just like Springs @Autowired
vs EE @Inject
, etc.).
I would NOT say, however, that reflection is not OOP - while it possibly goes against pure encapsulation, it is integral part of major OOP languages for good reasons. Reflection usage does not imply AOP either.
AOP is typically used to call something before/after/around the method - the code that is not visible there - and is often represented by an annotation (like Springs @Transactional
), but can be also declared elsewhere (configuration). @PostConstruct
and @PreDestroy
on the other hand are primarily life-cycle methods, kind of hooks that will happen at specific time - and anything they do is explicitly in the code.
So there is no aspect hidden in there, definitely no aspect in the typical AOP meaning. The only thing hidden is the magic that calls it in the right moment. But while Java does not support AOP directly, no AOP library is needed, just simple reflection. I doubt anybody would call JVM's shutdown hooks AOP either.