This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
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

spring AOP doesn't work

 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Edited to correct spelling of AOP in subject. Proofreading the subject, at least, is a good idea.

this is my Audiance.java class


this is my AudianceAdvice.java class


this is main.xml class
code]
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">;

<bean id="FoodService" class="com.aruna.Dog">
<property name="food" value="Chickenn" />
</bean>

<bean id="audiance" class="com.aruna.Audience"></bean>

<bean id="audienceAdvice" class="com.aruna.AudienceAdvice">
<property name="audience" ref="audience" />
</bean>

<bean id="performancePointcut" class="org.springframework.aop.support.JdkRegexpMethodPointcut">
<property name="pattern" value=".*perform" />
</bean>

<bean id="audienceAdvisor" class="org.springframework.aop.support.DefaultPointcutAdvisor">
<property name="advice" ref="audienceAdvice" />
<property name="pointcut" ref="performancePointcut" />
</bean>

</beans>[/code]

this is main class


but it gives me only
CLAP CLAP CLAP CLAP CLAP as a output.
why the AOP doesn't working??
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because the regex "*.perform" appears nowhere but in your regex?
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand what are you saying.Can you explaing little bit more?
Actually i am new to Spring AOP .I am try to run this example.
can you please tell me the error ?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does the "pattern" property mean in a JdkRegexpMethodPointcut?
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok
which class i need to include perform method?
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I change my classes.
now main class is here


main.xml is here


juggler class here


Audience class here


AudienceAdvice is here

now when i run main class it just gives
JUGGLING 3 BEANBAGS
why still not running AOP ?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you're focusing too narrowly here: take a step back. What's the difference between what you're doing and what the configuration you're using is doing? Can you think of a way to make it work without adding a method matching ".*perform"? Or, if you're dead-set on using that regex, where do *you* think you'd need to add a method ending with "perform"?
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I change the classes as above.Still No good results.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please, *please* try to work through what's happening here.

Answer these questions (here, in the forum):

- What are you attempting to use AOP on?
- What objects do you instantiate?
- What methods do you call on which objects?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic