473,405 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Problem with AOP+Spring

dmjpro
2,476 2GB
I have five source files.

Expand|Select|Wrap|Line Numbers
  1. public class SpringAOP implements SpringAOPInterface
  2. {
  3.     public void showMessage()
  4.     {
  5.         System.out.println("I m learning Spring+AOP, & i really enjoying dis :-)");
  6.     }
  7. }
  8.  
  9. public interface SpringAOPInterface
  10. {
  11.     public void showMessage();
  12. }
  13.  
  14. import org.springframework.aop.*;
  15. import java.lang.reflect.Method;
  16.  
  17. public class SpringAOPAdvice implements MethodBeforeAdvice
  18. {
  19.     public void before(Method method,Object args[],Object Target) throws Throwable
  20.     {
  21.         System.out.println("My logging message is here");
  22.     }
  23. }
  24.  
  25. import org.springframework.beans.factory.*;
  26. import org.springframework.beans.factory.xml.*;
  27. import org.springframework.context.support.*;
  28. import org.springframework.core.io.*;
  29.  
  30. public class SpringAOPTest
  31. {
  32.     public static void main(String args[])
  33.     {
  34.         /*BeanFactory b = new XmlBeanFactory(new FileSystemResource("c:/SpringAOP.xml"));
  35.         ((SpringAOP)b.getBean("testTarget")).showMessage();*/
  36.         FileSystemXmlApplicationContext c = new FileSystemXmlApplicationContext("c:/SpringAOP.xml");
  37.         ((SpringAOP)c.getBean("testTarget")).showMessage();
  38.         System.out.println("Yahoo....Done it............!!!");
  39.     }
  40. }
  41.  
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
  3.  
  4. <beans>
  5. <bean id="testTarget" class="SpringAOP"/>
  6. <bean id="testAdvice" class="SpringAOPAdvice"/>
  7. <!--<bean id="testPointcutAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
  8. <property name="mappedName">
  9. <value>void showMessage()</value>
  10. </property>
  11. <property name="advice">
  12. <ref bean="testAdvice"/>
  13. </property>
  14. </bean>-->
  15. <bean id="testProxyBean" class="org.springframework.aop.framework.ProxyFactoryBean">
  16. <property name="interceptorNames">
  17. <list>
  18. <value>testAdvice</value>
  19. </list>
  20. </property>
  21. <property name="target">
  22. <ref bean="testTarget"/>
  23. </property>
  24. </bean>
  25. </beans>
  26.  
Right now my Logging message is not printed :-(
Where I am going wrong.
Please help !

Kind regards,
Dmjpro.
Sep 27 '07 #1
2 1476
dmjpro
2,476 2GB
Please help me !
It's urgent.

Kind regards,
Dmjpro.
Sep 28 '07 #2
dmjpro
2,476 2GB
Please help me !
It's urgent.

Kind regards,
Dmjpro.
Hello Nobody is here :-)
Sep 28 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: skiserf | last post by:
Hi, I am having this interesting SQL problem with mysql Ver 12.22 Distrib 4.0.16, for apple-darwin7.0 (powerpc). For some reason count(*) does give the right result, when I replace it with...
2
by: nanookfan | last post by:
Hi all, I'm having a bizarre problem converting XML files to HTML using an XSLT. The problem is only occuring in my Netscape 7.0 browser. What makes it more bizarre is that it is only...
1
by: Flare | last post by:
Hi, I heard alot of IoC containers and aspect oriented programming for the Java / J2EE world, eg, Spring, AspectJ, Pico, etc. I find the idea very compeeling that the framework calls the...
3
by: Maurice Mertens | last post by:
Hi all, In VB.NET you can set the DropDownStyle for a combobox to 'DropDown' or 'DropDownList'. When you set it to DropDownList, it supports auto-fill. But when you set it to 'DropDown', the...
2
by: Peter Kirk | last post by:
Hi there I come from the "Java world" where I used "Spring" and "Hibernate" in web-application development. Is there anyone who has experience using these frameworks in a .NET / c# setting? Are...
0
by: ramyareddy | last post by:
Hi All, i am using mssql 2005 and i am facing a strange problem. i have two databases A , B.When i try to insert one row in A from my application it is inserting the row but after that it is...
8
by: Rustom Mody | last post by:
I am interested in AOP in python. From here one naturally (or google-ly) reaches peak. But peak seems to be discontinued. Whereas pep-246 on adaptors seems to be rejected in favor of something...
6
by: BMc | last post by:
So, as per Beauregard's suggestion, I have delved into the world of percentages and more fluid design for my next project. I am going along okay so far and have already determined that I will be...
3
by: abc.com | last post by:
as subject
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.