Summary

Cross-cutting concerns such as logging and security are some of the most important features of well-developed applications.

In this chapter, we have understood why cross-cutting concerns are best developed using AOP. We have understood the basic concepts of AOP—PointCuts, advice, and weaving.

Then, we looked at the popular options for implementing AOP with the Spring Framework—Spring AOP and AspectJ. We learned that Spring AOP is recommended when you want to weave around Spring beans. For more complex features, AspectJ is the framework to use.

Afterwards, we looked at examples of implementing different advice with Spring AOP—@Before, @Around, @After, and @AfterReturning. We understood the best practice in defining PointCuts, which is creating a common PointCut class. Then, we learned to implement a custom AOP annotation in order to identify methods where advice has to be applied to.

Next, we explored the different options that the Spring Framework provides to schedule your tasks. We also learned how to run our tasks in parallel with @Async. We also explored an important task executor—ThreadPoolTaskExecutor.

Then, we looked at how you can execute JavaScript and Groovy scripts with the Spring Framework, with the important JSR 223 interfaces—ScriptEngineManager, ScriptEngine, and Bindings.

At the end of this chapter, we learned how to schedule tasks and execute dynamic scripts with the Spring Framework.

In the next chapter, we will start our journey toward building great REST API and Full Stack applications with Spring Boot.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset