Monday 22 May 2023

Micronaut: Working with aspects

Aspects are used to implement the cross cutting concerns like logging, transaction management etc.,

 

Application code is separated from cross cutting concerns in the form of aspects that define advice.

 

In general, there are two forms of advices.

a.   Around advice: decorates a method or class

b.   Introduction Advice - introduces new behaviour to a class.

 

Unlike other AOP solutions, Micronaut do not use reflections, which slows application performance, makes debugging harder and increases memory consumption. Micronaut provides a simple compile-time AOP API that does not use reflection.

Micronaut: Around advice: Decorate a method
Micronaut: Introduction advice
Micronaut: Method adapter advice example


Previous                                                    Next                                                    Home

No comments:

Post a Comment