473,670 Members | 2,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with AOP+Spring

dmjpro
2,476 Top Contributor
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 1491
dmjpro
2,476 Top Contributor
Please help me !
It's urgent.

Kind regards,
Dmjpro.
Sep 28 '07 #2
dmjpro
2,476 Top Contributor
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
1412
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 sum(1) it works. mysql> select term, year, count(*) from course where year = 2001 group by term, year; +--------+------+--------------------+ | term | year | count(*) |
2
3399
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 happening when I put my XML files and the .xsl files on my ISP's system for my home page. If I try to open the XML files in Netscape 7.0 on my own machine (ie, not on the ISP's system), the pages convert file and the result is displayed in HTML.
1
1715
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 obejct instead of the objects call some kind of static factory. More over the aspect oriented way eg. to do logging also seems quite interesting. Is these things possible in .net? Are there any interesting and production ready solutions out there?
3
2118
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 auto-fill support is gone. How can I get auto-fill on a combobox with a dropdownstyle 'DropDown'? --
2
12441
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 they mature in the .NET world yet? Thanks, Peter
0
1186
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 giving page not found exception when i try to retrieve the data to display form the same table. When i do the same operation on B from my applciation it is not throwing any error. 1)Is it to do with the lock levels set on the data base. can you...
8
1591
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 else. What?? Can someone please throw some light on whats the current state of the art?
6
1548
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 doing a conditional comment for a separate Stylesheet for IE but I am having a problem now in Firefox, Safari, and Opera. If you would like to see my problem, please visit http://myweb.fltg.net/users/bethmcgee/index.html
0
8468
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8901
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8814
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6213
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5683
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4209
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4390
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2799
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2041
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.