• Post Reply Bookmark Topic Watch Topic
  • New Topic

AOP in JEE

 
M Burke
Ranch Hand
Posts: 406
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to trigger processes when certain functionality is executed in a JEE or Java application. I know about servlet filters and I use them when specific Servlets are called. But what about POJO's?

Here are some examples of what I would like to do:
When a DAO is about to be called, a process to trace parameters going into a stored procedure executes.
An exception occurs and is pushed to the stack, a process detects this and logs the error.
A global variable is changed by a side door process. Another process detects this and does some re initialization.
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure you can easily add AOP to POJOs, but entities and stateless/stateful/singleton beans aren't that hard. For entities, you can attach entity listeners. Those are limited to triggers before and after JPA events such as updating, persisting, etc. For beans you can add interceptors that can add functionality, or even completely skip executing a bean method.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!