mercredi 26 septembre 2018

CDI Interceptor vs CDI events

I have a question about the best implementation to have a system in java EE that is as uncoupled as possible, the question is whether it is better to use CDI events or CDI interceptors, obviously for things like security would be an interceptor, for logs for example any of the two according to the specific case, but for business rules in which a certain task must be done while another is executed.

Leaving aside that asynchronous events may or may not occur, my doubt is more in favor of the decoupling of modules, since for my concept the events are more decoupled than the interceptors, since in the interceptor the class that contains the function must be defined intercept, but in the case of events only the message must be defined.

Aucun commentaire:

Enregistrer un commentaire