wood burning stoves 2.0*
The moose likes Aspect Oriented Programming and the fly likes Spring AOP issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Aspect Oriented Programming
Bookmark "Spring AOP issue" Watch "Spring AOP issue" New topic
Author

Spring AOP issue

Vijay Kumar
Ranch Hand

Joined: Jul 24, 2003
Posts: 260
Hi All,

I am new to spring.

Downloaded spring-framework-3.1.0.RC1 and trying to create a simple aop based program.

Please see spring configuration file Application.xml




As mentioned in configuration file, I am using POJO based aspect, but while running my sample program I am facing below exception



i am wondering why this class is not present in spring 3.1. On web I was suggested to add 'aopalliance-1.0.jar'. I add this but after that I got below exception and was suggested to add - aspectjweaver.jar.



I am not sure why spring is asking me to include aspectj jars. Even though I am using POJO base aop. looks like there is an internal dependencies. If I am downloading the complete package of spring then all the libraries must be present in that.


Thanks for reading this.

Thanks,
Vijay
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

Because Spring AOP is based on AspectJ AOP project, and therefore some of the classes and stuff are defined by AspectJ and not in Spring. So you have to include some AspectJ jar files. Basically Spring is using some 3rd party classes to implement Spring AOP and they come from AspectJ.

Hope that helps clear things up for you.

Good Luck

I also recommend doing Spring AOP with Annotations, it is much simpler to configure than the xml stuff you are doing. (You still need the AspectJ jars)

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Vijay Kumar
Ranch Hand

Joined: Jul 24, 2003
Posts: 260
Thanks Mark,


So even I am using POJO base AOP, I need AspectJ and associated jar.

I am not sure who can answer it - Why spring library does not include the dependent jars?

Thanks
Vijay
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1031
    
    5

Vijay

Why should Spring contain all dependent jars? When you download any jar, it will normally tell you what other libraries it requires to run.

I think when you use something like Apache Maven, you begin to see the true use of jar files and their dependency on other libraries.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

Vijay Kumar wrote:Thanks Mark,


So even I am using POJO base AOP, I need AspectJ and associated jar.

I am not sure who can answer it - Why spring library does not include the dependent jars?

Thanks
Vijay


Not sure what you mean by POJO base AOP, as for me all my Aspect classes are POJOs, actually all my classes are POJOs.
Spring AOP is a subset of AspectJ and requires some AspectJ jars in the classpath.

Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring AOP issue