November 2018
Intermediate to advanced
388 pages
9h 5m
English
We can now activate AuditInterceptor. One way of doing this is to specify the interceptor in the beans.xml files, as shown here:
<interceptors> <class> <AuditInterceptor> </class></interceptors>
Alternatively, we can specify this with the @Priority annotation, which indicates the interceptor's priority. For example, we can annotate the AuditInterceptor class with the @Priority annotation APPLICATION level:
@Interceptor@Auditable@Priority(Interceptor.Priority.APPLICATION)class AuditInterceptor { @Inject private lateinit var auditor: Auditor @Inject private lateinit var auditProcessor: AuditProcessor @AroundInvoke fun handle(context: InvocationContext) { auditor.audit("message") auditProcessor .processMessage(context.method.getAnnotation(Auditable::class.java).value) ...Read now
Unlock full access