Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

AOP in Spring 5

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

Aspect Oriented Programming seems to have quite a bit of promise, and Spring appears to support it.  But there is very little guidance on how to do it, especially if you compare it to other topics like Spring Data or Spring Web MVC, (which I understand are much more popular topics).

Do you have any recommendations for reading on when you might use AOP (other than logging, please), and more to the point, how you would implement it in Spring 5?

Thanks!
Keith
 
author
Posts: 469
20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Keith,

The book has a specific chapter on AOP that covers all aspects of Spring's support for AOP. If you read the chapter, you'll get the idea that AOP is used wherever there are cross-cutting concerns.

regards
Ashish
 
Bartender
Posts: 1061
19
Mac OS X IntelliJ IDE Oracle Spring VI Editor Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My understanding is the idea behind AOP is to address two major issues with code; code scattering and code tangling.  

Logging, transactions, security, debugging, diagnostics would be candidates.
 
Saloon Keeper
Posts: 22289
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Peter Rooke wrote:My understanding is the idea behind AOP is to address two major issues with code; code scattering and code tangling.  

Logging, transactions, security, debugging, diagnostics would be candidates.



Cross-cutting.

The normal organization of a system's functions is a hierarchical tree (Directed Acyclic Graph), working from the top down. With AOP, you go sideways instead.

A tree can have only one root. You can, however, have many aspects, as you've noted.

To simplify the application of aspects, one defines templates and uses a code processor to apply them to existing code. This can be done either at the source code level (which means basically writing an entire compiler) or by weaving into the generated bytecodes - which avoids having to do a lot of lexical scanning, parsing, and digestion.

In a sense, Java annotations also embody AOP, but you have to manually attach them to the code in question.

Spring itself has several function sets that lend themselves to the aspect-oriented approach. So what Keith really wanted to know is how Spring 5 changes them.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic