Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

AOP and Spring

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

i heared about AOP in Spring, but i still confusing the concept of AOP and his utility in Spring,
can anyone give us the concept and the utility to use AOP ?

thanks
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Julio leopard banderas wrote:Hey,

i heared about AOP in Spring, but i still confusing the concept of AOP and his utility in Spring,
can anyone give us the concept and the utility to use AOP ?

thanks



Hi Julio,

I too learning AOP in Spring these days, I can help you in understanding what AOP is and its utility in any web application.

Suppose you have a class say Audience and in that class you have methods say
1) takeSeats()
2) switchOffMobile()
3) appluad()

Also you have a pojo class say Compititor which is having fields Name and Instrument

we have a class ShowStarting which look like this once you initialized bean for Competitor and Audience



You can eliminate these cross cutting concerns and allow Spring to handle these. This is one of the advantage of AOP.
These cross cutting concerns you have to write in an xml to tell spring when and where to call them.
 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can find here some some good materials about AOP:
JBoss AOP and Aspect-oriented Programming.
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Shailesh Phatak wrote:

Julio leopard banderas wrote:Hey,

i heared about AOP in Spring, but i still confusing the concept of AOP and his utility in Spring,
can anyone give us the concept and the utility to use AOP ?

thanks



Hi Julio,

I too learning AOP in Spring these days, I can help you in understanding what AOP is and its utility in any web application.

Suppose you have a class say Audience and in that class you have methods say
1) takeSeats()
2) switchOffMobile()
3) appluad()

Also you have a pojo class say Compititor which is having fields Name and Instrument

we have a class ShowStarting which look like this once you initialized bean for Competitor and Audience



You can eliminate these cross cutting concerns and allow Spring to handle these. This is one of the advantage of AOP.
These cross cutting concerns you have to write in an xml to tell spring when and where to call them.



I'm not sure how your example is going to explain AOP but maybe it is just me.

It is worth noting that XML isn't the only way to configure your Aspects, you can also use annotations.
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Spring uses aspects behind the scenes to do many of the things you probably use. Any cross cutting concern is a good candidate such as security, logging, and transactions. You can leverage spring-aop to create your own aspects or use AspectJ with Spring for even more powerful constructs. As was said with Spring AOP you can take an annotation or xml configuration approach. When using AspectJ you can also use the AspectJ language (to write .aj files).

One example of how this is used is the @Transactional annotation. Typically there would be a lot of boiler plate around creating transactions, committing them and rolling them back. Some of this would have to happen before the database operation and some of it after. AspectJ is used to inject code before and after a method annotated with @Transactional so that you no longer have to do this things every single time you wish to use transactions.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic