August 2018
Intermediate to advanced
314 pages
8h 9m
English
Having an interceptor in a separate class improves code maintenance by providing a clear division of responsibilities between classes, meaning that the classes become more cohesive. In addition, interceptor classes may have resources and managed beans injected into them.
Another important factor worth mentioning is that the interceptor method belongs to the same EJB transaction context. So, whenever we want to intercept a business logic to do a technical task, such as logging or statistic persistence, we must take care. For instance, we don't want any errors to be thrown during statistic control, thereby generating a business transaction rollback.
In this case, we should perform asynchronous ...
Read now
Unlock full access